" Vimball Archiver by Charles E. Campbell, Jr., Ph.D. UseVimball finish autoload/tagbar.vim [[[1 2927 " ============================================================================ " File: tagbar.vim " Description: List the current file's tags in a sidebar, ordered by class etc " Author: Jan Larres " Licence: Vim licence " Website: http://majutsushi.github.com/tagbar/ " Version: 2.2 " Note: This plugin was heavily inspired by the 'Taglist' plugin by " Yegappan Lakshmanan and uses a small amount of code from it. " " Original taglist copyright notice: " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, " taglist.vim is provided *as is* and comes with no warranty of " any kind, either expressed or implied. In no event will the " copyright holder be liable for any damamges resulting from the " use of this software. " ============================================================================ scriptencoding utf-8 " Initialization {{{1 " Basic init {{{2 if !exists('g:tagbar_ctags_bin') if executable('ctags-exuberant') let g:tagbar_ctags_bin = 'ctags-exuberant' elseif executable('exuberant-ctags') let g:tagbar_ctags_bin = 'exuberant-ctags' elseif executable('exctags') let g:tagbar_ctags_bin = 'exctags' elseif has('macunix') && executable('/usr/local/bin/ctags') " Homebrew default location let g:tagbar_ctags_bin = '/usr/local/bin/ctags' elseif has('macunix') && executable('/opt/local/bin/ctags') " Macports default location let g:tagbar_ctags_bin = '/opt/local/bin/ctags' elseif executable('ctags') let g:tagbar_ctags_bin = 'ctags' elseif executable('ctags.exe') let g:tagbar_ctags_bin = 'ctags.exe' elseif executable('tags') let g:tagbar_ctags_bin = 'tags' else echomsg 'Tagbar: Exuberant ctags not found, skipping plugin' finish endif else " reset 'wildignore' temporarily in case *.exe is included in it let wildignore_save = &wildignore set wildignore& let g:tagbar_ctags_bin = expand(g:tagbar_ctags_bin) let &wildignore = wildignore_save if !executable(g:tagbar_ctags_bin) echomsg 'Tagbar: Exuberant ctags not found in specified place,' \ 'skipping plugin' finish endif endif redir => s:ftype_out silent filetype redir END if s:ftype_out !~# 'detection:ON' echomsg 'Tagbar: Filetype detection is turned off, skipping plugin' unlet s:ftype_out finish endif unlet s:ftype_out if has('multi_byte') && has('unix') && &encoding == 'utf-8' && \ (empty(&termencoding) || &termencoding == 'utf-8') let s:icon_closed = '▶' let s:icon_open = '▼' elseif has('multi_byte') && (has('win32') || has('win64')) && g:tagbar_usearrows let s:icon_closed = '▷' let s:icon_open = '◢' else let s:icon_closed = '+' let s:icon_open = '-' endif let s:type_init_done = 0 let s:autocommands_done = 0 let s:checked_ctags = 0 let s:window_expanded = 0 let s:access_symbols = { \ 'public' : '+', \ 'protected' : '#', \ 'private' : '-' \ } let g:loaded_tagbar = 1 let s:last_highlight_tline = 0 " s:InitTypes() {{{2 function! s:InitTypes() let s:known_types = {} " Ant {{{3 let type_ant = {} let type_ant.ctagstype = 'ant' let type_ant.kinds = [ \ {'short' : 'p', 'long' : 'projects', 'fold' : 0}, \ {'short' : 't', 'long' : 'targets', 'fold' : 0} \ ] let s:known_types.ant = type_ant " Asm {{{3 let type_asm = {} let type_asm.ctagstype = 'asm' let type_asm.kinds = [ \ {'short' : 'm', 'long' : 'macros', 'fold' : 0}, \ {'short' : 't', 'long' : 'types', 'fold' : 0}, \ {'short' : 'd', 'long' : 'defines', 'fold' : 0}, \ {'short' : 'l', 'long' : 'labels', 'fold' : 0} \ ] let s:known_types.asm = type_asm " ASP {{{3 let type_aspvbs = {} let type_aspvbs.ctagstype = 'asp' let type_aspvbs.kinds = [ \ {'short' : 'd', 'long' : 'constants', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} \ ] let s:known_types.aspvbs = type_aspvbs " Awk {{{3 let type_awk = {} let type_awk.ctagstype = 'awk' let type_awk.kinds = [ \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.awk = type_awk " Basic {{{3 let type_basic = {} let type_basic.ctagstype = 'basic' let type_basic.kinds = [ \ {'short' : 'c', 'long' : 'constants', 'fold' : 0}, \ {'short' : 'g', 'long' : 'enumerations', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, \ {'short' : 't', 'long' : 'types', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} \ ] let s:known_types.basic = type_basic " BETA {{{3 let type_beta = {} let type_beta.ctagstype = 'beta' let type_beta.kinds = [ \ {'short' : 'f', 'long' : 'fragments', 'fold' : 0}, \ {'short' : 's', 'long' : 'slots', 'fold' : 0}, \ {'short' : 'v', 'long' : 'patterns', 'fold' : 0} \ ] let s:known_types.beta = type_beta " C {{{3 let type_c = {} let type_c.ctagstype = 'c' let type_c.kinds = [ \ {'short' : 'd', 'long' : 'macros', 'fold' : 1}, \ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1}, \ {'short' : 'g', 'long' : 'enums', 'fold' : 0}, \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0}, \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0}, \ {'short' : 's', 'long' : 'structs', 'fold' : 0}, \ {'short' : 'u', 'long' : 'unions', 'fold' : 0}, \ {'short' : 'm', 'long' : 'members', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let type_c.sro = '::' let type_c.kind2scope = { \ 'g' : 'enum', \ 's' : 'struct', \ 'u' : 'union' \ } let type_c.scope2kind = { \ 'enum' : 'g', \ 'struct' : 's', \ 'union' : 'u' \ } let s:known_types.c = type_c " C++ {{{3 let type_cpp = {} let type_cpp.ctagstype = 'c++' let type_cpp.kinds = [ \ {'short' : 'd', 'long' : 'macros', 'fold' : 1}, \ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1}, \ {'short' : 'g', 'long' : 'enums', 'fold' : 0}, \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0}, \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0}, \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 's', 'long' : 'structs', 'fold' : 0}, \ {'short' : 'u', 'long' : 'unions', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'm', 'long' : 'members', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} \ ] let type_cpp.sro = '::' let type_cpp.kind2scope = { \ 'g' : 'enum', \ 'n' : 'namespace', \ 'c' : 'class', \ 's' : 'struct', \ 'u' : 'union' \ } let type_cpp.scope2kind = { \ 'enum' : 'g', \ 'namespace' : 'n', \ 'class' : 'c', \ 'struct' : 's', \ 'union' : 'u' \ } let s:known_types.cpp = type_cpp " C# {{{3 let type_cs = {} let type_cs.ctagstype = 'c#' let type_cs.kinds = [ \ {'short' : 'd', 'long' : 'macros', 'fold' : 1}, \ {'short' : 'f', 'long' : 'fields', 'fold' : 0}, \ {'short' : 'g', 'long' : 'enums', 'fold' : 0}, \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0}, \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0}, \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0}, \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 's', 'long' : 'structs', 'fold' : 0}, \ {'short' : 'E', 'long' : 'events', 'fold' : 0}, \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, \ {'short' : 'p', 'long' : 'properties', 'fold' : 0} \ ] let type_cs.sro = '.' let type_cs.kind2scope = { \ 'n' : 'namespace', \ 'i' : 'interface', \ 'c' : 'class', \ 's' : 'struct', \ 'g' : 'enum' \ } let type_cs.scope2kind = { \ 'namespace' : 'n', \ 'interface' : 'i', \ 'class' : 'c', \ 'struct' : 's', \ 'enum' : 'g' \ } let s:known_types.cs = type_cs " COBOL {{{3 let type_cobol = {} let type_cobol.ctagstype = 'cobol' let type_cobol.kinds = [ \ {'short' : 'd', 'long' : 'data items', 'fold' : 0}, \ {'short' : 'f', 'long' : 'file descriptions', 'fold' : 0}, \ {'short' : 'g', 'long' : 'group items', 'fold' : 0}, \ {'short' : 'p', 'long' : 'paragraphs', 'fold' : 0}, \ {'short' : 'P', 'long' : 'program ids', 'fold' : 0}, \ {'short' : 's', 'long' : 'sections', 'fold' : 0} \ ] let s:known_types.cobol = type_cobol " DOS Batch {{{3 let type_dosbatch = {} let type_dosbatch.ctagstype = 'dosbatch' let type_dosbatch.kinds = [ \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} \ ] let s:known_types.dosbatch = type_dosbatch " Eiffel {{{3 let type_eiffel = {} let type_eiffel.ctagstype = 'eiffel' let type_eiffel.kinds = [ \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'f', 'long' : 'features', 'fold' : 0} \ ] let type_eiffel.sro = '.' " Not sure, is nesting even possible? let type_eiffel.kind2scope = { \ 'c' : 'class', \ 'f' : 'feature' \ } let type_eiffel.scope2kind = { \ 'class' : 'c', \ 'feature' : 'f' \ } let s:known_types.eiffel = type_eiffel " Erlang {{{3 let type_erlang = {} let type_erlang.ctagstype = 'erlang' let type_erlang.kinds = [ \ {'short' : 'm', 'long' : 'modules', 'fold' : 0}, \ {'short' : 'd', 'long' : 'macro definitions', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'r', 'long' : 'record definitions', 'fold' : 0} \ ] let type_erlang.sro = '.' " Not sure, is nesting even possible? let type_erlang.kind2scope = { \ 'm' : 'module' \ } let type_erlang.scope2kind = { \ 'module' : 'm' \ } let s:known_types.erlang = type_erlang " Flex {{{3 " Vim doesn't support Flex out of the box, this is based on rough " guesses and probably requires " http://www.vim.org/scripts/script.php?script_id=2909 " Improvements welcome! let type_mxml = {} let type_mxml.ctagstype = 'flex' let type_mxml.kinds = [ \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, \ {'short' : 'p', 'long' : 'properties', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'x', 'long' : 'mxtags', 'fold' : 0} \ ] let type_mxml.sro = '.' let type_mxml.kind2scope = { \ 'c' : 'class' \ } let type_mxml.scope2kind = { \ 'class' : 'c' \ } let s:known_types.mxml = type_mxml " Fortran {{{3 let type_fortran = {} let type_fortran.ctagstype = 'fortran' let type_fortran.kinds = [ \ {'short' : 'm', 'long' : 'modules', 'fold' : 0}, \ {'short' : 'p', 'long' : 'programs', 'fold' : 0}, \ {'short' : 'k', 'long' : 'components', 'fold' : 0}, \ {'short' : 't', 'long' : 'derived types and structures', 'fold' : 0}, \ {'short' : 'c', 'long' : 'common blocks', 'fold' : 0}, \ {'short' : 'b', 'long' : 'block data', 'fold' : 0}, \ {'short' : 'e', 'long' : 'entry points', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0}, \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, \ {'short' : 'n', 'long' : 'namelists', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} \ ] let type_fortran.sro = '.' " Not sure, is nesting even possible? let type_fortran.kind2scope = { \ 'm' : 'module', \ 'p' : 'program', \ 'f' : 'function', \ 's' : 'subroutine' \ } let type_fortran.scope2kind = { \ 'module' : 'm', \ 'program' : 'p', \ 'function' : 'f', \ 'subroutine' : 's' \ } let s:known_types.fortran = type_fortran " HTML {{{3 let type_html = {} let type_html.ctagstype = 'html' let type_html.kinds = [ \ {'short' : 'f', 'long' : 'JavaScript funtions', 'fold' : 0}, \ {'short' : 'a', 'long' : 'named anchors', 'fold' : 0} \ ] let s:known_types.html = type_html " Java {{{3 let type_java = {} let type_java.ctagstype = 'java' let type_java.kinds = [ \ {'short' : 'p', 'long' : 'packages', 'fold' : 1}, \ {'short' : 'f', 'long' : 'fields', 'fold' : 0}, \ {'short' : 'g', 'long' : 'enum types', 'fold' : 0}, \ {'short' : 'e', 'long' : 'enum constants', 'fold' : 0}, \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'm', 'long' : 'methods', 'fold' : 0} \ ] let type_java.sro = '.' let type_java.kind2scope = { \ 'g' : 'enum', \ 'i' : 'interface', \ 'c' : 'class' \ } let type_java.scope2kind = { \ 'enum' : 'g', \ 'interface' : 'i', \ 'class' : 'c' \ } let s:known_types.java = type_java " JavaScript {{{3 " JavaScript is weird -- it does have scopes, but ctags doesn't seem to " properly generate the information for them, instead it simply uses the " complete name. So ctags has to be fixed before I can do anything here. " Alternatively jsctags/doctorjs will be used if available. let type_javascript = {} let type_javascript.ctagstype = 'javascript' if executable('jsctags') let type_javascript.kinds = [ \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let type_javascript.sro = '.' let type_javascript.kind2scope = { \ 'v' : 'namespace', \ 'f' : 'namespace' \ } let type_javascript.scope2kind = { \ 'namespace' : 'v' \ } let type_javascript.ctagsbin = 'jsctags' let type_javascript.ctagsargs = '-f -' else let type_javascript.kinds = [ \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'p', 'long' : 'properties', 'fold' : 0}, \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] endif let s:known_types.javascript = type_javascript " Lisp {{{3 let type_lisp = {} let type_lisp.ctagstype = 'lisp' let type_lisp.kinds = [ \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.lisp = type_lisp " Lua {{{3 let type_lua = {} let type_lua.ctagstype = 'lua' let type_lua.kinds = [ \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.lua = type_lua " Make {{{3 let type_make = {} let type_make.ctagstype = 'make' let type_make.kinds = [ \ {'short' : 'm', 'long' : 'macros', 'fold' : 0} \ ] let s:known_types.make = type_make " Matlab {{{3 let type_matlab = {} let type_matlab.ctagstype = 'matlab' let type_matlab.kinds = [ \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.matlab = type_matlab " Ocaml {{{3 let type_ocaml = {} let type_ocaml.ctagstype = 'ocaml' let type_ocaml.kinds = [ \ {'short' : 'M', 'long' : 'modules or functors', 'fold' : 0}, \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'C', 'long' : 'constructors', 'fold' : 0}, \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, \ {'short' : 'e', 'long' : 'exceptions', 'fold' : 0}, \ {'short' : 't', 'long' : 'type names', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'r', 'long' : 'structure fields', 'fold' : 0} \ ] let type_ocaml.sro = '.' " Not sure, is nesting even possible? let type_ocaml.kind2scope = { \ 'M' : 'Module', \ 'c' : 'class', \ 't' : 'type' \ } let type_ocaml.scope2kind = { \ 'Module' : 'M', \ 'class' : 'c', \ 'type' : 't' \ } let s:known_types.ocaml = type_ocaml " Pascal {{{3 let type_pascal = {} let type_pascal.ctagstype = 'pascal' let type_pascal.kinds = [ \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0} \ ] let s:known_types.pascal = type_pascal " Perl {{{3 let type_perl = {} let type_perl.ctagstype = 'perl' let type_perl.kinds = [ \ {'short' : 'p', 'long' : 'packages', 'fold' : 1}, \ {'short' : 'c', 'long' : 'constants', 'fold' : 0}, \ {'short' : 'f', 'long' : 'formats', 'fold' : 0}, \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0} \ ] let s:known_types.perl = type_perl " PHP {{{3 let type_php = {} let type_php.ctagstype = 'php' let type_php.kinds = [ \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'd', 'long' : 'constant definitions', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, \ {'short' : 'j', 'long' : 'javascript functions', 'fold' : 0} \ ] let s:known_types.php = type_php " Python {{{3 let type_python = {} let type_python.ctagstype = 'python' let type_python.kinds = [ \ {'short' : 'i', 'long' : 'imports', 'fold' : 1}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'm', 'long' : 'members', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} \ ] let type_python.sro = '.' let type_python.kind2scope = { \ 'c' : 'class', \ 'f' : 'function', \ 'm' : 'function' \ } let type_python.scope2kind = { \ 'class' : 'c', \ 'function' : 'f' \ } let s:known_types.python = type_python " REXX {{{3 let type_rexx = {} let type_rexx.ctagstype = 'rexx' let type_rexx.kinds = [ \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0} \ ] let s:known_types.rexx = type_rexx " Ruby {{{3 let type_ruby = {} let type_ruby.ctagstype = 'ruby' let type_ruby.kinds = [ \ {'short' : 'm', 'long' : 'modules', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'f', 'long' : 'methods', 'fold' : 0}, \ {'short' : 'F', 'long' : 'singleton methods', 'fold' : 0} \ ] let type_ruby.sro = '.' let type_ruby.kind2scope = { \ 'c' : 'class', \ 'm' : 'class' \ } let type_ruby.scope2kind = { \ 'class' : 'c' \ } let s:known_types.ruby = type_ruby " Scheme {{{3 let type_scheme = {} let type_scheme.ctagstype = 'scheme' let type_scheme.kinds = [ \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 's', 'long' : 'sets', 'fold' : 0} \ ] let s:known_types.scheme = type_scheme " Shell script {{{3 let type_sh = {} let type_sh.ctagstype = 'sh' let type_sh.kinds = [ \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.sh = type_sh let s:known_types.csh = type_sh let s:known_types.zsh = type_sh " SLang {{{3 let type_slang = {} let type_slang.ctagstype = 'slang' let type_slang.kinds = [ \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.slang = type_slang " SML {{{3 let type_sml = {} let type_sml.ctagstype = 'sml' let type_sml.kinds = [ \ {'short' : 'e', 'long' : 'exception declarations', 'fold' : 0}, \ {'short' : 'f', 'long' : 'function definitions', 'fold' : 0}, \ {'short' : 'c', 'long' : 'functor definitions', 'fold' : 0}, \ {'short' : 's', 'long' : 'signature declarations', 'fold' : 0}, \ {'short' : 'r', 'long' : 'structure declarations', 'fold' : 0}, \ {'short' : 't', 'long' : 'type definitions', 'fold' : 0}, \ {'short' : 'v', 'long' : 'value bindings', 'fold' : 0} \ ] let s:known_types.sml = type_sml " SQL {{{3 " The SQL ctags parser seems to be buggy for me, so this just uses the " normal kinds even though scopes should be available. Improvements " welcome! let type_sql = {} let type_sql.ctagstype = 'sql' let type_sql.kinds = [ \ {'short' : 'P', 'long' : 'packages', 'fold' : 1}, \ {'short' : 'c', 'long' : 'cursors', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'F', 'long' : 'record fields', 'fold' : 0}, \ {'short' : 'L', 'long' : 'block label', 'fold' : 0}, \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0}, \ {'short' : 's', 'long' : 'subtypes', 'fold' : 0}, \ {'short' : 't', 'long' : 'tables', 'fold' : 0}, \ {'short' : 'T', 'long' : 'triggers', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, \ {'short' : 'i', 'long' : 'indexes', 'fold' : 0}, \ {'short' : 'e', 'long' : 'events', 'fold' : 0}, \ {'short' : 'U', 'long' : 'publications', 'fold' : 0}, \ {'short' : 'R', 'long' : 'services', 'fold' : 0}, \ {'short' : 'D', 'long' : 'domains', 'fold' : 0}, \ {'short' : 'V', 'long' : 'views', 'fold' : 0}, \ {'short' : 'n', 'long' : 'synonyms', 'fold' : 0}, \ {'short' : 'x', 'long' : 'MobiLink Table Scripts', 'fold' : 0}, \ {'short' : 'y', 'long' : 'MobiLink Conn Scripts', 'fold' : 0} \ ] let s:known_types.sql = type_sql " Tcl {{{3 let type_tcl = {} let type_tcl.ctagstype = 'tcl' let type_tcl.kinds = [ \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0} \ ] let s:known_types.tcl = type_tcl " LaTeX {{{3 let type_tex = {} let type_tex.ctagstype = 'tex' let type_tex.kinds = [ \ {'short' : 'p', 'long' : 'parts', 'fold' : 0}, \ {'short' : 'c', 'long' : 'chapters', 'fold' : 0}, \ {'short' : 's', 'long' : 'sections', 'fold' : 0}, \ {'short' : 'u', 'long' : 'subsections', 'fold' : 0}, \ {'short' : 'b', 'long' : 'subsubsections', 'fold' : 0}, \ {'short' : 'P', 'long' : 'paragraphs', 'fold' : 0}, \ {'short' : 'G', 'long' : 'subparagraphs', 'fold' : 0} \ ] let s:known_types.tex = type_tex " Vera {{{3 " Why are variables 'virtual'? let type_vera = {} let type_vera.ctagstype = 'vera' let type_vera.kinds = [ \ {'short' : 'd', 'long' : 'macros', 'fold' : 1}, \ {'short' : 'g', 'long' : 'enums', 'fold' : 0}, \ {'short' : 'T', 'long' : 'typedefs', 'fold' : 0}, \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0}, \ {'short' : 'm', 'long' : 'members', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 't', 'long' : 'tasks', 'fold' : 0}, \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, \ {'short' : 'p', 'long' : 'programs', 'fold' : 0} \ ] let type_vera.sro = '.' " Nesting doesn't seem to be possible let type_vera.kind2scope = { \ 'g' : 'enum', \ 'c' : 'class', \ 'v' : 'virtual' \ } let type_vera.scope2kind = { \ 'enum' : 'g', \ 'class' : 'c', \ 'virtual' : 'v' \ } let s:known_types.vera = type_vera " Verilog {{{3 let type_verilog = {} let type_verilog.ctagstype = 'verilog' let type_verilog.kinds = [ \ {'short' : 'c', 'long' : 'constants', 'fold' : 0}, \ {'short' : 'e', 'long' : 'events', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'm', 'long' : 'modules', 'fold' : 0}, \ {'short' : 'n', 'long' : 'net data types', 'fold' : 0}, \ {'short' : 'p', 'long' : 'ports', 'fold' : 0}, \ {'short' : 'r', 'long' : 'register data types', 'fold' : 0}, \ {'short' : 't', 'long' : 'tasks', 'fold' : 0} \ ] let s:known_types.verilog = type_verilog " VHDL {{{3 " The VHDL ctags parser unfortunately doesn't generate proper scopes let type_vhdl = {} let type_vhdl.ctagstype = 'vhdl' let type_vhdl.kinds = [ \ {'short' : 'P', 'long' : 'packages', 'fold' : 1}, \ {'short' : 'c', 'long' : 'constants', 'fold' : 0}, \ {'short' : 't', 'long' : 'types', 'fold' : 0}, \ {'short' : 'T', 'long' : 'subtypes', 'fold' : 0}, \ {'short' : 'r', 'long' : 'records', 'fold' : 0}, \ {'short' : 'e', 'long' : 'entities', 'fold' : 0}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0} \ ] let s:known_types.vhdl = type_vhdl " Vim {{{3 let type_vim = {} let type_vim.ctagstype = 'vim' let type_vim.kinds = [ \ {'short' : 'v', 'long' : 'variables', 'fold' : 1}, \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, \ {'short' : 'a', 'long' : 'autocommand groups', 'fold' : 1}, \ {'short' : 'c', 'long' : 'commands', 'fold' : 0}, \ {'short' : 'm', 'long' : 'maps', 'fold' : 1} \ ] let s:known_types.vim = type_vim " YACC {{{3 let type_yacc = {} let type_yacc.ctagstype = 'yacc' let type_yacc.kinds = [ \ {'short' : 'l', 'long' : 'labels', 'fold' : 0} \ ] let s:known_types.yacc = type_yacc " }}}3 let user_defs = s:GetUserTypeDefs() for [key, value] in items(user_defs) if !has_key(s:known_types, key) || \ (has_key(value, 'replace') && value.replace) let s:known_types[key] = value else call extend(s:known_types[key], value) endif endfor " Create a dictionary of the kind order for fast " access in sorting functions for type in values(s:known_types) let i = 0 let type.kinddict = {} for kind in type.kinds let type.kinddict[kind.short] = i let i += 1 endfor endfor let s:type_init_done = 1 endfunction " s:GetUserTypeDefs() {{{2 function! s:GetUserTypeDefs() redir => defs silent execute 'let g:' redir END let deflist = split(defs, '\n') call map(deflist, 'substitute(v:val, ''^\S\+\zs.*'', "", "")') call filter(deflist, 'v:val =~ "^tagbar_type_"') let defdict = {} for defstr in deflist let type = substitute(defstr, '^tagbar_type_', '', '') execute 'let defdict["' . type . '"] = g:' . defstr endfor " If the user only specified one of kind2scope and scope2kind use it to " generate the other one " Also, transform the 'kind' definitions into dictionary format for def in values(defdict) let kinds = def.kinds let def.kinds = [] for kind in kinds let kindlist = split(kind, ':') let kinddict = {'short' : kindlist[0], 'long' : kindlist[1]} if len(kindlist) == 3 let kinddict.fold = kindlist[2] else let kinddict.fold = 0 endif call add(def.kinds, kinddict) endfor if has_key(def, 'kind2scope') && !has_key(def, 'scope2kind') let def.scope2kind = {} for [key, value] in items(def.kind2scope) let def.scope2kind[value] = key endfor elseif has_key(def, 'scope2kind') && !has_key(def, 'kind2scope') let def.kind2scope = {} for [key, value] in items(def.scope2kind) let def.kind2scope[value] = key endfor endif endfor return defdict endfunction " s:RestoreSession() {{{2 " Properly restore Tagbar after a session got loaded function! s:RestoreSession() let tagbarwinnr = bufwinnr('__Tagbar__') if tagbarwinnr == -1 " Tagbar wasn't open in the saved session, nothing to do return else let in_tagbar = 1 if winnr() != tagbarwinnr execute tagbarwinnr . 'wincmd w' let in_tagbar = 0 endif endif if !s:type_init_done call s:InitTypes() endif if !s:checked_ctags if !s:CheckForExCtags() return endif endif call s:InitWindow(g:tagbar_autoclose) " Leave the Tagbar window and come back so the update event gets triggered wincmd p execute tagbarwinnr . 'wincmd w' if !in_tagbar wincmd p endif endfunction " s:MapKeys() {{{2 function! s:MapKeys() nnoremap