📄 taglist.vim
字号:
" c languagelet s:tlist_def_c_settings = 'c;d:macro;g:enum;s:struct;u:union;t:typedef;' . \ 'v:variable;f:function'" c++ languagelet s:tlist_def_cpp_settings = 'c++;n:namespace;v:variable;d:macro;t:typedef;' . \ 'c:class;g:enum;s:struct;u:union;f:function'" c# languagelet s:tlist_def_cs_settings = 'c#;d:macro;t:typedef;n:namespace;c:class;' . \ 'E:event;g:enum;s:struct;i:interface;' . \ 'p:properties;m:method'" cobol languagelet s:tlist_def_cobol_settings = 'cobol;d:data;f:file;g:group;p:paragraph;' . \ 'P:program;s:section'" eiffel languagelet s:tlist_def_eiffel_settings = 'eiffel;c:class;f:feature'" erlang languagelet s:tlist_def_erlang_settings = 'erlang;d:macro;r:record;m:module;f:function'" expect (same as tcl) languagelet s:tlist_def_expect_settings = 'tcl;c:class;f:method;p:procedure'" fortran languagelet s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' . \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' . \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine'" HTML languagelet s:tlist_def_html_settings = 'html;a:anchor;f:javascript function'" java languagelet s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' . \ 'f:field;m:method'" javascript languagelet s:tlist_def_javascript_settings = 'javascript;f:function'" lisp languagelet s:tlist_def_lisp_settings = 'lisp;f:function'" lua languagelet s:tlist_def_lua_settings = 'lua;f:function'" makefileslet s:tlist_def_make_settings = 'make;m:macro'" pascal languagelet s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure'" perl languagelet s:tlist_def_perl_settings = 'perl;c:constant;l:label;p:package;s:subroutine'" php languagelet s:tlist_def_php_settings = 'php;c:class;d:constant;v:variable;f:function'" python languagelet s:tlist_def_python_settings = 'python;c:class;m:member;f:function'" rexx languagelet s:tlist_def_rexx_settings = 'rexx;s:subroutine'" ruby languagelet s:tlist_def_ruby_settings = 'ruby;c:class;f:method;F:function;' . \ 'm:singleton method'" scheme languagelet s:tlist_def_scheme_settings = 'scheme;s:set;f:function'" shell languagelet s:tlist_def_sh_settings = 'sh;f:function'" C shell languagelet s:tlist_def_csh_settings = 'sh;f:function'" Z shell languagelet s:tlist_def_zsh_settings = 'sh;f:function'" slang languagelet s:tlist_def_slang_settings = 'slang;n:namespace;f:function'" sml languagelet s:tlist_def_sml_settings = 'sml;e:exception;c:functor;s:signature;' . \ 'r:structure;t:type;v:value;f:function'" sql languagelet s:tlist_def_sql_settings = 'sql;c:cursor;F:field;P:package;r:record;' . \ 's:subtype;t:table;T:trigger;v:variable;f:function;p:procedure'" tcl languagelet s:tlist_def_tcl_settings = 'tcl;c:class;f:method;m:method;p:procedure'" vera languagelet s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' . \ 'f:function;g:enum;m:member;p:program;' . \ 'P:prototype;t:task;T:typedef;v:variable;' . \ 'x:externvar'"verilog languagelet s:tlist_def_verilog_settings = 'verilog;m:module;c:constant;P:parameter;' . \ 'e:event;r:register;t:task;w:write;p:port;v:variable;f:function'" vim languagelet s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function'" yacc languagelet s:tlist_def_yacc_settings = 'yacc;l:label'"------------------- end of language specific options --------------------" Vim window size is changed by the taglist plugin or notlet s:tlist_winsize_chgd = -1" Taglist window is maximized or notlet s:tlist_win_maximized = 0" Name of files in the taglistlet s:tlist_file_names=''" Number of files in the taglistlet s:tlist_file_count = 0" Number of filetypes supported by taglistlet s:tlist_ftype_count = 0" Is taglist part of other plugins like winmanager or cream?let s:tlist_app_name = "none"" Are we displaying brief help textlet s:tlist_brief_help = 1" List of files removed on user requestlet s:tlist_removed_flist = """ Index of current file displayed in the taglist windowlet s:tlist_cur_file_idx = -1" Taglist menu is empty or notlet s:tlist_menu_empty = 1" An autocommand is used to refresh the taglist window when entering any" buffer. We don't want to refresh the taglist window if we are entering the" file window from one of the taglist functions. The 'Tlist_Skip_Refresh'" variable is used to skip the refresh of the taglist window and is set" and cleared appropriately.let s:Tlist_Skip_Refresh = 0" Tlist_Window_Display_Help()function! s:Tlist_Window_Display_Help() if s:tlist_app_name == "winmanager" " To handle a bug in the winmanager plugin, add a space at the " last line call setline('$', ' ') endif if s:tlist_brief_help " Add the brief help call append(0, '" Press <F1> to display help text') else " Add the extensive help call append(0, '" <enter> : Jump to tag definition') call append(1, '" o : Jump to tag definition in new window') call append(2, '" p : Preview the tag definition') call append(3, '" <space> : Display tag prototype') call append(4, '" u : Update tag list') call append(5, '" s : Select sort field') call append(6, '" d : Remove file from taglist') call append(7, '" x : Zoom-out/Zoom-in taglist window') call append(8, '" + : Open a fold') call append(9, '" - : Close a fold') call append(10, '" * : Open all folds') call append(11, '" = : Close all folds') call append(12, '" [[ : Move to the start of previous file') call append(13, '" ]] : Move to the start of next file') call append(14, '" q : Close the taglist window') call append(15, '" <F1> : Remove help text') endifendfunction" Tlist_Window_Toggle_Help_Text()" Toggle taglist plugin help text between the full version and the brief" versionfunction! s:Tlist_Window_Toggle_Help_Text() if g:Tlist_Compact_Format " In compact display mode, do not display help return endif " Include the empty line displayed after the help text let brief_help_size = 1 let full_help_size = 16 setlocal modifiable " Set report option to a huge value to prevent informational messages " while deleting the lines let old_report = &report set report=99999 " Remove the currently highlighted tag. Otherwise, the help text " might be highlighted by mistake match none " Toggle between brief and full help text if s:tlist_brief_help let s:tlist_brief_help = 0 " Remove the previous help exe '1,' . brief_help_size . ' delete _' " Adjust the start/end line numbers for the files call s:Tlist_Window_Update_Line_Offsets(0, 1, full_help_size - brief_help_size) else let s:tlist_brief_help = 1 " Remove the previous help exe '1,' . full_help_size . ' delete _' " Adjust the start/end line numbers for the files call s:Tlist_Window_Update_Line_Offsets(0, 0, full_help_size - brief_help_size) endif call s:Tlist_Window_Display_Help() " Restore the report option let &report = old_report setlocal nomodifiableendfunction" Taglist debug supportlet s:tlist_debug = 0" File for storing the debug messageslet s:tlist_debug_file = ''" Tlist_Debug_Enable" Enable logging of taglist debug messages.function! s:Tlist_Debug_Enable(...) let s:tlist_debug = 1 " Check whether a valid file name is supplied. if a:1 != '' let s:tlist_debug_file = fnamemodify(a:1, ':p') " Empty the log file exe 'redir! > ' . s:tlist_debug_file redir END " Check whether the log file is present/created if !filewritable(s:tlist_debug_file) call s:Tlist_Warning_Msg('Taglist: Unable to create log file ' \ . s:tlist_debug_file) let s:tlist_debug_file = '' endif endifendfunction" Tlist_Debug_Disable" Disable logging of taglist debug messages.function! s:Tlist_Debug_Disable(...) let s:tlist_debug = 0 let s:tlist_debug_file = ''endfunction" Tlist_Debug_Show" Display the taglist debug message in a new windowfunction! s:Tlist_Debug_Show() if s:tlist_debug == 0 call s:Tlist_Warning_Msg('Taglist: Debug is disabled') return endif if s:tlist_msg == '' call s:Tlist_Warning_Msg('Taglist: No debug messages') return endif " Open a new window to display the taglist debug messages new taglist_debug.txt " Delete all the lines (if the buffer already exists) silent! %delete _ " Add the messages silent! put =s:tlist_msg " Move the cursor to the first line normal! ggendfunction" Tlist_Log_Msg" Log the supplied debug message along with the timefunction! s:Tlist_Log_Msg(msg) if s:tlist_debug if s:tlist_debug_file != '' exe 'redir >> ' . s:tlist_debug_file silent echon strftime('%H:%M:%S') . ': ' . a:msg . "\n" redir END else " Log the message into a variable " Retain only the last 3000 characters let len = strlen(s:tlist_msg) if len > 3000 let s:tlist_msg = strpart(s:tlist_msg, len - 3000) endif let s:tlist_msg = s:tlist_msg . strftime('%H:%M:%S') . ': ' . \ a:msg . "\n" endif endifendfunction" Tlist_Warning_Msg()" Display a message using WarningMsg highlight groupfunction! s:Tlist_Warning_Msg(msg) echohl WarningMsg echomsg a:msg echohl Noneendfunction" Last returned file index for file name lookup." Used to speed up file lookuplet s:tlist_file_name_idx_cache = -1" Tlist_Get_File_Index()" Return the index of the specified filenamefunction! s:Tlist_Get_File_Index(fname) if s:tlist_file_count == 0 || a:fname == '' return -1 endif " If the new filename is same as the last accessed filename, then " return that index if s:tlist_file_name_idx_cache != -1 && \ s:tlist_file_name_idx_cache < s:tlist_file_count if s:tlist_{s:tlist_file_name_idx_cache}_filename == a:fname " Same as the last accessed file return s:tlist_file_name_idx_cache endif endif " First, check whether the filename is present let s_fname = a:fname . "\n" let i = stridx(s:tlist_file_names, s_fname) if i == -1 let s:tlist_file_name_idx_cache = -1 return -1 endif " Second, compute the file name index let nl_txt = substitute(strpart(s:tlist_file_names, 0, i), "[^\n]", '', 'g') let s:tlist_file_name_idx_cache = strlen(nl_txt) return s:tlist_file_name_idx_cacheendfunction" Last returned file index for line number lookup." Used to speed up file lookuplet s:tlist_file_lnum_idx_cache = -1" Tlist_Window_Get_File_Index_By_Linenum()" Return the index of the filename present in the specified line number" Line number refers to the line number in the taglist windowfunction! s:Tlist_Window_Get_File_Index_By_Linenum(lnum) call s:Tlist_Log_Msg('Tlist_Window_Get_File_Index_By_Linenum (' . a:lnum . ')') " First try to see whether the new line number is within the range " of the last returned file if s:tlist_file_lnum_idx_cache != -1 && \ s:tlist_file_lnum_idx_cache < s:tlist_file_count if a:lnum >= s:tlist_{s:tlist_file_lnum_idx_cache}_start && \ a:lnum <= s:tlist_{s:tlist_file_lnum_idx_cache}_end return s:tlist_file_lnum_idx_cache endif endif let fidx = -1 if g:Tlist_Show_One_File " Displaying only one file in the taglist window. Check whether " the line is within the tags displayed for that file if s:tlist_cur_file_idx != -1 if a:lnum >= s:tlist_{s:tlist_cur_file_idx}_start \ && a:lnum <= s:tlist_{s:tlist_cur_file_idx}_end let fidx = s:tlist_cur_file_idx endif endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -