diff --git a/.vim/pack/plugins/start/vim-bufferline/LICENSE b/.vim/pack/plugins/start/vim-bufferline/LICENSE new file mode 100644 index 0000000..4697735 --- /dev/null +++ b/.vim/pack/plugins/start/vim-bufferline/LICENSE @@ -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. diff --git a/.vim/pack/plugins/start/vim-bufferline/README.md b/.vim/pack/plugins/start/vim-bufferline/README.md new file mode 100644 index 0000000..712226b --- /dev/null +++ b/.vim/pack/plugins/start/vim-bufferline/README.md @@ -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. diff --git a/.vim/pack/plugins/start/vim-bufferline/autoload/bufferline.vim b/.vim/pack/plugins/start/vim-bufferline/autoload/bufferline.vim new file mode 100644 index 0000000..9be66c9 --- /dev/null +++ b/.vim/pack/plugins/start/vim-bufferline/autoload/bufferline.vim @@ -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 diff --git a/.vim/pack/plugins/start/vim-bufferline/autoload/bufferline/algos/fixed_position.vim b/.vim/pack/plugins/start/vim-bufferline/autoload/bufferline/algos/fixed_position.vim new file mode 100644 index 0000000..ba33757 --- /dev/null +++ b/.vim/pack/plugins/start/vim-bufferline/autoload/bufferline/algos/fixed_position.vim @@ -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 + diff --git a/.vim/pack/plugins/start/vim-bufferline/doc/bufferline.txt b/.vim/pack/plugins/start/vim-bufferline/doc/bufferline.txt new file mode 100644 index 0000000..f5b5dcd --- /dev/null +++ b/.vim/pack/plugins/start/vim-bufferline/doc/bufferline.txt @@ -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: diff --git a/.vim/pack/plugins/start/vim-bufferline/img/bufferline-command.png b/.vim/pack/plugins/start/vim-bufferline/img/bufferline-command.png new file mode 100644 index 0000000..764ecc4 Binary files /dev/null and b/.vim/pack/plugins/start/vim-bufferline/img/bufferline-command.png differ diff --git a/.vim/pack/plugins/start/vim-bufferline/img/bufferline-status.png b/.vim/pack/plugins/start/vim-bufferline/img/bufferline-status.png new file mode 100644 index 0000000..5e18823 Binary files /dev/null and b/.vim/pack/plugins/start/vim-bufferline/img/bufferline-status.png differ diff --git a/.vim/pack/plugins/start/vim-bufferline/plugin/bufferline.vim b/.vim/pack/plugins/start/vim-bufferline/plugin/bufferline.vim new file mode 100644 index 0000000..24c05cc --- /dev/null +++ b/.vim/pack/plugins/start/vim-bufferline/plugin/bufferline.vim @@ -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 diff --git a/.vim/vimrc b/.vim/vimrc index b2d6242..5194f67 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -54,6 +54,9 @@ set textwidth=0 " automatically break lines here set list " display control characers set listchars=tab:>- " which characters to display +set wildmode=full + + let g:currentmode={ \ 'n' : 'NORMAL', \ 'v' : 'VISUAL', @@ -140,10 +143,8 @@ highlight VertSplit ctermfg=1 ctermbg=0 " Buffer NAVIGATION map  :bnext -imap  :bnext nmap  :bnext map  :bprevious -imap  :bprevious nmap  :bprevious " TMUX FIXES @@ -176,17 +177,22 @@ inoremap pumvisible() ? '' : '' inoremap pumvisible() ? '' : '' " 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_altv = 1 " open splits to the right let g:netrw_liststyle = 0 " tree view 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 set tags=.git/tags; " Search tagfile backward recursive nnoremap gt " Jump to tag (go tag) nnoremap gb " Jump to last position (go back) nnoremap gh :FSHere " Jump to header file (go header) +nnoremap bb :ls:b +nnoremap  :Lex " CSCOPE if has("cscope")