From 75e8d5d63af921a88834d3db1a467196f6b60bfa Mon Sep 17 00:00:00 2001 From: ChansonShen Date: Mon, 22 Feb 2016 22:42:37 +0800 Subject: [PATCH] Added tagbar --- sources_non_forked/tagbar | 1 + .../autoload/airline/extensions/tabline.vim | 31 ++++++++++++++---- .../airline/extensions/tabline/buffers.vim | 21 ++---------- .../airline/extensions/tabline/ctrlspace.vim | 7 ++-- .../airline/extensions/tabline/tabs.vim | 32 +++++++++++++------ .../vim-airline/doc/airline.txt | 8 ++++- .../doc/{snipMate.txt => SnipMate.txt} | 0 update_plugins.py | 1 + vimrcs/plugins_config.vim | 6 ++++ 9 files changed, 70 insertions(+), 37 deletions(-) create mode 160000 sources_non_forked/tagbar rename sources_non_forked/vim-snipmate/doc/{snipMate.txt => SnipMate.txt} (100%) diff --git a/sources_non_forked/tagbar b/sources_non_forked/tagbar new file mode 160000 index 00000000..7b36c46d --- /dev/null +++ b/sources_non_forked/tagbar @@ -0,0 +1 @@ +Subproject commit 7b36c46d17d57db34fdb0adac9ba6382d0bb5e66 diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim index 0447952b..de6d55e4 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim @@ -5,6 +5,7 @@ let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree') + let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0) if s:taboo let g:taboo_tabline = 0 @@ -47,7 +48,7 @@ function! s:update_tabline() elseif !get(g:, 'airline#extensions#tabline#enabled', 0) return " return, if buffer matches ignore pattern or is directory (netrw) - elseif empty(match) + elseif empty(match) \ || match(match, s:ignore_bufadd_pat) > -1 \ || isdirectory(expand("")) return @@ -57,11 +58,6 @@ function! s:update_tabline() endif call feedkeys("\AirlineTablineRefresh") call feedkeys("\AirlineTablineRefresh") - "call feedkeys(',,', 't') - "call feedkeys(':unmap ,,') - " force re-evaluation of tabline setting - " disable explicit redraw, may cause E315 - "redraw endfunction function! airline#extensions#tabline#load_theme(palette) @@ -92,6 +88,7 @@ function! airline#extensions#tabline#load_theme(palette) " Theme for tabs on the right let l:tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a) + let l:tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c) let l:tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a) let l:tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c) if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') @@ -100,6 +97,7 @@ function! airline#extensions#tabline#load_theme(palette) "Fall back to normal airline_c if modified airline_c isn't present let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c) endif + call airline#highlighter#exec('airline_tab_right', l:tab_right) call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right) call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right) call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right) @@ -163,3 +161,24 @@ function! airline#extensions#tabline#new_builder() return airline#builder#new(builder_context) endfunction + +function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr) + let cur = bufnr('%') + if cur == a:bufnr + if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') + let group = 'airline_tabmod' + else + let group = 'airline_tabsel' + endif + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 + else + if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') + let group = 'airline_tabmod_unsel' + elseif index(a:tab_bufs, a:bufnr) > -1 + let group = 'airline_tab' + else + let group = 'airline_tabhid' + endif + endif + return group +endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/buffers.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/buffers.vim index 96b1a877..c35507ca 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/buffers.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/buffers.vim @@ -5,6 +5,7 @@ scriptencoding utf-8 let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) +let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') let s:spc = g:airline_symbols.space let s:current_bufnr = -1 @@ -64,23 +65,7 @@ function! airline#extensions#tabline#buffers#get() continue endif - if cur == nr - if g:airline_detect_modified && getbufvar(nr, '&modified') - let group = 'airline_tabmod' - else - let group = 'airline_tabsel' - endif - let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 - else - if g:airline_detect_modified && getbufvar(nr, '&modified') - let group = 'airline_tabmod_unsel' - elseif index(tab_bufs, nr) > -1 - let group = 'airline_tab' - else - let group = 'airline_tabhid' - endif - endif - + let group = airline#extensions#tabline#group_of_bufnr(tab_bufs, nr) if s:buffer_idx_mode if len(s:number_map) > 0 call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc) @@ -97,7 +82,7 @@ function! airline#extensions#tabline#buffers#get() call b.split() call b.add_section('airline_tabfill', '') if s:show_tab_type - call b.add_section('airline_tabtype', ' buffers ') + call b.add_section_spaced('airline_tabtype', s:buffers_label) endif let s:current_bufnr = cur diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim index 9490ab02..a27a37e4 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim @@ -7,6 +7,9 @@ let s:current_bufnr = -1 let s:current_tabnr = -1 let s:current_tabline = '' +let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') +let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') + function! airline#extensions#tabline#ctrlspace#off() augroup airline_tabline_ctrlspace autocmd! @@ -41,7 +44,7 @@ function! airline#extensions#tabline#ctrlspace#get() let b = airline#extensions#tabline#new_builder() - call b.add_section_spaced('airline_tabtype', 'buffers') + call b.add_section_spaced('airline_tabtype', s:buffers_label) let s:buffer_list = ctrlspace#api#BufferList(cur_tab) for buffer in s:buffer_list @@ -88,7 +91,7 @@ function! airline#extensions#tabline#ctrlspace#get() call b.add_section_spaced(group, tab.title.ctrlspace#api#TabBuffersNumber(tab.index)) endfor - call b.add_section_spaced('airline_tabtype', 'tabs') + call b.add_section_spaced('airline_tabtype', s:tabs_label) let s:current_bufnr = cur_buf let s:current_tabnr = cur_tab diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/tabs.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/tabs.vim index 02e4dc9d..0dba19bc 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/tabs.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/tabs.vim @@ -1,11 +1,14 @@ " MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 -let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1) -let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1) let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) +let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1) +let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X') +let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') +let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1) +let s:spc = g:airline_symbols.space let s:current_bufnr = -1 let s:current_tabnr = -1 @@ -39,19 +42,20 @@ function! airline#extensions#tabline#tabs#get() endif let b = airline#extensions#tabline#new_builder() + for i in range(1, tabpagenr('$')) if i == curtab - let group = 'airline_tabsel' + let group = 'airline_tabsel_right' if g:airline_detect_modified for bi in tabpagebuflist(i) if getbufvar(bi, '&modified') - let group = 'airline_tabmod' + let group = 'airline_tabmod_right' endif endfor endif - let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 + let s:current_modified = (group == 'airline_tabmod_right') ? 1 : 0 else - let group = 'airline_tab' + let group = 'airline_tab_right' endif let val = '%(' if s:show_tab_nr @@ -66,14 +70,22 @@ function! airline#extensions#tabline#tabs#get() call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') endfor - call b.add_raw('%T') call b.add_section('airline_tabfill', '') call b.split() + call b.add_section('airline_tabfill', '') + if s:show_close_button - call b.add_section('airline_tab', ' %999X'.s:close_symbol.' ') + call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ') endif - if s:show_tab_type - call b.add_section('airline_tabtype', ' tabs ') + + if s:show_splits == 1 + let buffers = tabpagebuflist(curtab) + for nr in buffers + let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) + call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') + endfor + elseif s:show_tab_type == 1 + call b.add_section_spaced('airline_tabtype', s:tabs_label) endif let s:current_bufnr = curbuf diff --git a/sources_non_forked/vim-airline/doc/airline.txt b/sources_non_forked/vim-airline/doc/airline.txt index 79e10122..16fe8f11 100644 --- a/sources_non_forked/vim-airline/doc/airline.txt +++ b/sources_non_forked/vim-airline/doc/airline.txt @@ -518,9 +518,15 @@ eclim * enable/disable displaying index of the buffer. Note: If you're using ctrlspace the tabline shows your tabs on the right and - buffer on the left. Also none of the tabline switches is currently + buffer on the left. Also none of the above tabline switches is currently supported! +* rename label for buffers (default: 'buffers') + let g:airline#extensions#tabline#buffers_label = 'b' + +* rename label for tabs (default: 'tabs') + let g:airline#extensions#tabline#tabs_label = 't' + When enabled, numbers will be displayed in the tabline and mappings will be exposed to allow you to select a buffer directly. Up to 9 mappings will be exposed. > diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/SnipMate.txt similarity index 100% rename from sources_non_forked/vim-snipmate/doc/snipMate.txt rename to sources_non_forked/vim-snipmate/doc/SnipMate.txt diff --git a/update_plugins.py b/update_plugins.py index 5ea87f24..f9473f60 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -52,6 +52,7 @@ vim-gitgutter https://github.com/airblade/vim-gitgutter gruvbox https://github.com/morhetz/gruvbox vim-flake8 https://github.com/nvie/vim-flake8 vim-pug https://github.com/digitaltoad/vim-pug +tagbar https://github.com/majutsushi/tagbar """.strip() GITHUB_ZIP = '%s/archive/master.zip' diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index da48f593..676d1f9a 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -148,3 +148,9 @@ nnoremap l :call SyntasticCheckCoffeescript() """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:gitgutter_enabled=0 nnoremap d :GitGutterToggle + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Tagbar +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +nmap :TagbarToggle