Update 2024-09-27 11:27 Linux/x86_64-ld5587

This commit is contained in:
c0dev0id 2024-09-27 11:27:50 +02:00
parent c8beb061e5
commit 6f6ae09c01
9 changed files with 387 additions and 3 deletions

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (C) 2013 Bailey Ling
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,38 @@
# vim-bufferline
Super simple vim plugin to show the list of buffers in the command bar.
# screenshots
#### in the statusline
![img](img/bufferline-status.png)
#### or the command bar
![img](img/bufferline-command.png)
# configuration
`:help bufferline`
# installation
* [pathogen](https://github.com/tpope/vim-pathogen)
* `git clone https://github.com/bling/vim-bufferline ~/.vim/bundle/vim-bufferline`
* [neobundle](https://github.com/Shougo/neobundle.vim)
* `NeoBundle 'bling/vim-bufferline'`
* [vundle](https://github.com/gmarik/vundle)
* `Plugin 'bling/vim-bufferline'`
* [vam](https://github.com/MarcWeber/vim-addon-manager)
* `call vam#ActivateAddons([ 'vim-bufferline' ])`
* [vim-plug](https://github.com/junegunn/vim-plug)
* `Plug 'bling/vim-bufferline'`
# credits
This was inspired by the [buftabs](http://www.vim.org/scripts/script.php?script_id=1664) script.
# license
MIT License. Copyright (c) 2013 Bailey Ling.

View File

@ -0,0 +1,130 @@
" keep track of vimrc setting
let s:updatetime = &updatetime
" keep track of scrollinf window start
let s:window_start = 0
function! s:generate_names()
let names = []
let i = 1
let last_buffer = bufnr('$')
let current_buffer = bufnr('%')
while i <= last_buffer
if bufexists(i) && buflisted(i)
let modified = ' '
if getbufvar(i, '&mod')
let modified = g:bufferline_modified
endif
let fname = fnamemodify(bufname(i), g:bufferline_fname_mod)
if g:bufferline_pathshorten != 0
let fname = pathshorten(fname)
endif
let fname = substitute(fname, "%", "%%", "g")
let skip = 0
for ex in g:bufferline_excludes
if match(fname, ex) > -1
let skip = 1
break
endif
endfor
if !skip
let name = ''
if g:bufferline_show_bufnr != 0 && g:bufferline_status_info.count >= g:bufferline_show_bufnr
let name = i . ':'
endif
let name .= fname . modified
if current_buffer == i
let name = g:bufferline_active_buffer_left . name . g:bufferline_active_buffer_right
let g:bufferline_status_info.current = name
else
let name = g:bufferline_separator . name . g:bufferline_separator
endif
call add(names, [i, name])
endif
endif
let i += 1
endwhile
if len(names) > 1
if g:bufferline_rotate == 1
call bufferline#algos#fixed_position#modify(names)
endif
endif
return names
endfunction
function! bufferline#get_echo_string()
" check for special cases like help files
let current = bufnr('%')
if !bufexists(current) || !buflisted(current)
return bufname('%')
endif
let names = s:generate_names()
let line = ''
for val in names
let line .= val[1]
endfor
let index = match(line, '\V'.g:bufferline_status_info.current)
let g:bufferline_status_info.count = len(names)
let g:bufferline_status_info.before = strpart(line, 0, index)
let g:bufferline_status_info.after = strpart(line, index + len(g:bufferline_status_info.current))
return line
endfunction
function! s:echo()
if &filetype ==# 'unite'
return
endif
let line = bufferline#get_echo_string()
" 12 is magical and is the threshold for when it doesn't wrap text anymore
let width = &columns - 12
if g:bufferline_rotate == 2
let current_buffer_start = stridx(line, g:bufferline_active_buffer_left)
let current_buffer_end = stridx(line, g:bufferline_active_buffer_right)
if current_buffer_start < s:window_start
let s:window_start = current_buffer_start
endif
if current_buffer_end > (s:window_start + width)
let s:window_start = current_buffer_end - width + 1
endif
let line = strpart(line, s:window_start, width)
else
let line = strpart(line, 0, width)
endif
echo line
if &updatetime != s:updatetime
let &updatetime = s:updatetime
endif
endfunction
function! s:cursorhold_callback()
call s:echo()
autocmd! bufferline CursorHold
endfunction
function! s:refresh(updatetime)
let &updatetime = a:updatetime
autocmd bufferline CursorHold * call s:cursorhold_callback()
endfunction
function! bufferline#init_echo()
augroup bufferline
au!
" events which output a message which should be immediately overwritten
autocmd BufWinEnter,WinEnter,InsertLeave,VimResized * call s:refresh(1)
augroup END
autocmd CursorHold * call s:echo()
endfunction

View File

@ -0,0 +1,9 @@
" pins the active buffer to a specific index in the list
function! bufferline#algos#fixed_position#modify(names)
let current = bufnr('%')
while a:names[g:bufferline_fixed_index][0] != current
let first = remove(a:names, 0)
call add(a:names, first)
endwhile
endfunction

View File

@ -0,0 +1,119 @@
*bufferline.txt* Simple plugin for generating buffer list names
==============================================================================
INTRODUCTION *bufferline*
vim-bufferline is a simple plugin that helps you keep track of all your open
buffers. It also integrates nicely with vim-airline.
==============================================================================
CONFIGURATION *bufferline-configuration*
There are a couple configuration values available (shown with their default
values):
* denotes whether bufferline should automatically echo to the command bar
>
let g:bufferline_echo = 1
<
* the separator used on the left side of a buffer
>
let g:bufferline_active_buffer_left = '['
<
* the separator used on the right side of a buffer
>
let g:bufferline_active_buffer_right = ']'
<
* the symbol to denote that a buffer is modified
>
let g:bufferline_modified = '+'
<
* denotes whether buffer numbers should be displayed
>
let g:bufferline_show_bufnr = 1
<
* denotes whether the bufferline should have rotation applied
>
" default, no rotate, no scrolling
let g:bufferline_rotate = 0
" scrolling with fixed current buffer position
let g:bufferline_rotate = 1
" scrolling without fixed current buffer position
let g:bufferline_rotate = 2
<
* only valid when `g:bufferline_rotate` is set to 1:
>
let g:bufferline_fixed_index = 0 "always first
let g:bufferline_fixed_index = 1 "always second (default)
let g:bufferline_fixed_index = -1 "always last
<
* denotes how to display the filename of a buffer (see |filename-modifiers|
for more details)
>
let g:bufferline_fname_mod = ':t'
<
* denotes the highlight group for inactive buffers when used in the
|statusline|
>
let g:bufferline_inactive_highlight = 'StatusLineNC'
<
* denotes the highlight group for the active buffer when used in the
|statusline|
>
let g:bufferline_active_highlight = 'StatusLine'
<
* denotes whether the active highlight should be used when there is only one
buffer.
>
let g:bufferline_solo_highlight = 0
<
* denotes any exclude patterns.
>
let g:bufferline_excludes = [] "see source for defaults
<
* denotes whether paths in buffer names should be |pathshorten()|-ed.
>
let g:bufferline_pathshorten = 0
<
==============================================================================
STATUSLINE INTEGRATION *bufferline-statusline*
>
let g:bufferline_echo = 0
autocmd VimEnter *
\ let &statusline='%{bufferline#refresh_status()}'
\ .bufferline#get_status_string()
<
The function refresh_status() returns an empty string and only exists to
populate some global variables. Since it is inside an %{} block, the
variables will get updated whenever the statusline needs to be drawn.
get_status_string() creates a string which references these variables.
==============================================================================
CONTRIBUTIONS *bufferline-contributions*
Contributions and pull requests are welcome.
==============================================================================
LICENSE *bufferline-license*
MIT License. Copyright © 2013 Bailey Ling.
vim:tw=78:ts=8:ft=help:norl:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,61 @@
if exists('g:loaded_bufferline')
finish
endif
let g:loaded_bufferline = 1
function! s:check_defined(variable, default)
if !exists(a:variable)
let {a:variable} = a:default
endif
endfunction
call s:check_defined('g:bufferline_active_buffer_left', '[')
call s:check_defined('g:bufferline_active_buffer_right', ']')
call s:check_defined('g:bufferline_separator', ' ')
call s:check_defined('g:bufferline_modified', '+')
call s:check_defined('g:bufferline_echo', 1)
call s:check_defined('g:bufferline_show_bufnr', 1)
call s:check_defined('g:bufferline_fname_mod', ':t')
call s:check_defined('g:bufferline_inactive_highlight', 'StatusLineNC')
call s:check_defined('g:bufferline_active_highlight', 'StatusLine')
call s:check_defined('g:bufferline_rotate', 0)
call s:check_defined('g:bufferline_fixed_index', 1)
call s:check_defined('g:bufferline_solo_highlight', 0)
call s:check_defined('g:bufferline_excludes', ['\[vimfiler\]'])
call s:check_defined('g:bufferline_pathshorten', 0)
function! bufferline#generate_string()
return "bufferline#generate_string() is obsolete! Please consult README."
endfunction
let g:bufferline_status_info = {
\ 'count': 0,
\ 'before': '',
\ 'current': '',
\ 'after': '',
\ }
function! bufferline#refresh_status()
if g:bufferline_solo_highlight
if g:bufferline_status_info.count == 1
exec printf('highlight! link %s %s', g:bufferline_active_highlight, g:bufferline_inactive_highlight)
else
exec printf('highlight! link %s NONE', g:bufferline_active_highlight)
endif
endif
call bufferline#get_echo_string()
return ''
endfunction
function! bufferline#get_status_string()
return
\ '%#'.g:bufferline_inactive_highlight.'#'
\.'%{g:bufferline_status_info.before}'
\.'%#'.g:bufferline_active_highlight.'#'
\.' %{g:bufferline_status_info.current} '
\.'%#'.g:bufferline_inactive_highlight.'#'
\.'%{g:bufferline_status_info.after}'
endfunction
if g:bufferline_echo
call bufferline#init_echo()
endif

View File

@ -54,6 +54,9 @@ set textwidth=0 " automatically break lines here
set list " display control characers set list " display control characers
set listchars=tab:>- " which characters to display set listchars=tab:>- " which characters to display
set wildmode=full
let g:currentmode={ let g:currentmode={
\ 'n' : 'NORMAL', \ 'n' : 'NORMAL',
\ 'v' : 'VISUAL', \ 'v' : 'VISUAL',
@ -140,10 +143,8 @@ highlight VertSplit ctermfg=1 ctermbg=0
" Buffer NAVIGATION " Buffer NAVIGATION
map  :bnext<CR> map  :bnext<CR>
imap  :bnext<CR>
nmap  :bnext<CR> nmap  :bnext<CR>
map  :bprevious<CR> map  :bprevious<CR>
imap  :bprevious<CR>
nmap  :bprevious<CR> nmap  :bprevious<CR>
" TMUX FIXES " TMUX FIXES
@ -176,17 +177,22 @@ inoremap <expr> <Down> pumvisible() ? '<C-n>' : '<Down>'
inoremap <expr> <Up> pumvisible() ? '<C-p>' : '<Up>' inoremap <expr> <Up> pumvisible() ? '<C-p>' : '<Up>'
" NETRW " NETRW
let g:netrw_banner = 1 " disable annoying banner let g:netrw_banner = 0 " disable annoying banner
let g:netrw_browse_split = 4 " open in prior window let g:netrw_browse_split = 4 " open in prior window
let g:netrw_altv = 1 " open splits to the right let g:netrw_altv = 1 " open splits to the right
let g:netrw_liststyle = 0 " tree view let g:netrw_liststyle = 0 " tree view
let g:netrw_ctags = "ectags" " ctags executable to use let g:netrw_ctags = "ectags" " ctags executable to use
let g:netrw_keepdir = 0
let g:netrw_winsize = 25
hi! link netrwMarkFile Search
" TAGS FILE " TAGS FILE
set tags=.git/tags; " Search tagfile backward recursive set tags=.git/tags; " Search tagfile backward recursive
nnoremap gt <c-]> " Jump to tag (go tag) nnoremap gt <c-]> " Jump to tag (go tag)
nnoremap gb <c-o> " Jump to last position (go back) nnoremap gb <c-o> " Jump to last position (go back)
nnoremap gh :FSHere<CR> " Jump to header file (go header) nnoremap gh :FSHere<CR> " Jump to header file (go header)
nnoremap bb :ls<cr>:b
nnoremap  :Lex<cr>
" CSCOPE " CSCOPE
if has("cscope") if has("cscope")