commit 6c0f348ad1ec38e0acb6d3b79f38dd853ea653c7 Author: Jan Larres Date: Tue Jan 11 22:36:49 2011 +1300 Initial commit diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim new file mode 100644 index 0000000..5250da6 --- /dev/null +++ b/plugin/tagbar.vim @@ -0,0 +1,292 @@ +" ============================================================================ +" File: tagbar.vim +" Description: List the current file's tags in a sidebar, ordered by class etc +" Maintainer: Jan Larres +" Licence: Vim licence +" Website: http://github.com/majutsushi/tagbar +" Note: This plugin was heavily inspired by the 'Taglist' plugin by +" Yegappan Lakshamanan and uses some small portions of code from +" it. +" ============================================================================ + +if &cp || exists('g:loaded_tagbar') + finish +endif + +if !exists('*system') + echomsg 'Tagbar: No system() function available, skipping plugin' + finish +endif + +if !exists('g:tagbar_ctags_exe') + if executable('exuberant-ctags') + let g:tagbar_ctags_exe = 'exuberant-ctags' + elseif executable('exctags') + let g:tagbar_ctags_exe = 'exctags' + elseif executable('ctags') + let g:tagbar_ctags_exe = 'ctags' + elseif executable('ctags.exe') + let g:tagbar_ctags_exe = 'ctags.exe' + elseif executable('tags') + let g:tagbar_ctags_exe = 'tags' + else + echomsg 'Tagbar: Exuberant ctags not found, skipping plugin' + finish + endif +endif + +let g:loaded_tagbar = 1 + +if !exists('g:tagbar_left') + let g:tagbar_left = 0 +endif + +if !exists('g:tagbar_width') + let g:tagbar_width = 30 +endif + +let s:known_files = {} +let s:known_types = {} + +function! s:ToggleWindow() + let tagbarwinnr = bufwinnr("__Tagbar__") + if tagbarwinnr != -1 + call s:CloseWindow() + return + endif + + call s:OpenWindow() +endfunction + +function! s:OpenWindow() + " If the tagbar window is already open jump to it + let tagbarwinnr = bufwinnr('__Tagbar__') + if tagbarwinnr != -1 && winnr() != tagbarwinnr +" execute tagbarwinnr . 'wincmd w' + return + endif + + let openpos = g:tagbar_left ? 'topleft vertical ' : 'botright vertical ' + execute 'silent! ' . openpos . g:tagbar_width . 'split ' . '__Tagbar__' + + setlocal noreadonly " in case the "view" mode is used + setlocal buftype=nofile + setlocal bufhidden=delete + setlocal noswapfile + setlocal nobuflisted + setlocal nomodifiable + setlocal filetype=tagbar + setlocal nolist + setlocal nonumber + setlocal norelativenumber + setlocal nowrap + setlocal winfixwidth + + setlocal foldenable + setlocal foldminlines=0 + setlocal foldmethod=manual + setlocal foldlevel=9999 + setlocal foldcolumn=1 + setlocal foldtext=v:folddashes.getline(v:foldstart) + + let cpoptions_save = &cpoptions + set cpoptions&vim + +" nnoremap