?? taglist.vim
字號:
" File: taglist.vim" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)" Version: 4.2" Last Modified: November 14, 2006" Copyright: Copyright (C) 2002-2006 Yegappan Lakshmanan" 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."" The "Tag List" plugin is a source code browser plugin for Vim and provides" an overview of the structure of the programming language files and allows" you to efficiently browse through source code files for different" programming languages. You can visit the taglist plugin home page for more" information:"" http://vim-taglist.sourceforge.net"" You can subscribe to the taglist mailing list to post your questions" or suggestions for improvement or to report bugs. Visit the following" page for subscribing to the mailing list:"" http://groups.yahoo.com/group/taglist/"" For more information about using this plugin, after installing the" taglist plugin, use the ":help taglist" command."" Installation" ------------" 1. Download the taglist.zip file and unzip the files to the $HOME/.vim" or the $HOME/vimfiles or the $VIM/vimfiles directory. This should" unzip the following two files (the directory structure should be" preserved):"" plugin/taglist.vim - main taglist plugin file" doc/taglist.txt - documentation (help) file"" Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath'" Vim help pages for more details about installing Vim plugins." 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or" $VIM/doc/vimfiles directory, start Vim and run the ":helptags ."" command to process the taglist help file." 3. If the exuberant ctags utility is not present in your PATH, then set the" Tlist_Ctags_Cmd variable to point to the location of the exuberant ctags" utility (not to the directory) in the .vimrc file." 4. If you are running a terminal/console version of Vim and the" terminal doesn't support changing the window width then set the" 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file." 5. Restart Vim." 6. You can now use the ":TlistToggle" command to open/close the taglist" window. You can use the ":help taglist" command to get more" information about using the taglist plugin."" ****************** Do not modify after this line ************************" Line continuation used herelet s:cpo_save = &cposet cpo&vimif !exists('loaded_taglist') " First time loading the taglist plugin " " To speed up the loading of Vim, the taglist plugin uses autoload " mechanism to load the taglist functions. " Only define the configuration variables, user commands and some " auto-commands and finish sourcing the file " The taglist plugin requires the built-in Vim system() function. If this " function is not available, then don't load the plugin. if !exists('*system') echomsg 'Taglist: Vim system() built-in function is not available. ' . \ 'Plugin is not loaded.' let loaded_taglist = 'no' let &cpo = s:cpo_save finish endif " Location of the exuberant ctags tool if !exists('Tlist_Ctags_Cmd') if executable('exuberant-ctags') " On Debian Linux, exuberant ctags is installed " as exuberant-ctags let Tlist_Ctags_Cmd = 'exuberant-ctags' elseif executable(' exctags') " On Free-BSD, exuberant ctags is installed as exctags let Tlist_Ctags_ Cmd = 'exctags' elseif executable('ctags') let Tlist_Ctags_Cmd = 'ctags' elseif executable('ctags.exe') let Tlist_Ctags_Cmd = 'ctags.exe' elseif executable('tags') let Tlist_Ctags_Cmd = 'tags' else echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' . \ 'not found in PATH. Plugin is not loaded.' " Skip loading the plugin let loaded_taglist = 'no' let &cpo = s:cpo_save finish endif endif " Automatically open the taglist window on Vim startup if !exists('Tlist_Auto_Open') let Tlist_Auto_Open = 0 endif " When the taglist window is toggle opened, move the cursor to the " taglist window if !exists('Tlist_GainFocus_On_ToggleOpen') let Tlist_GainFocus_On_ToggleOpen = 0 endif " Process files even when the taglist window is not open if !exists('Tlist_Process_File_Always') let Tlist_Process_File_Always = 0 endif if !exists('Tlist_Show_Menu') let Tlist_Show_Menu = 0 endif " Tag listing sort type - 'name' or 'order' if !exists('Tlist_Sort_Type') let Tlist_Sort_Type = 'order' endif " Tag listing window split (horizontal/vertical) control if !exists('Tlist_Use_Horiz_Window') let Tlist_Use_Horiz_Window = 0 endif " Open the vertically split taglist window on the left or on the right " side. This setting is relevant only if Tlist_Use_Horiz_Window is set to " zero (i.e. only for vertically split windows) if !exists('Tlist_Use_Right_Window') let Tlist_Use_Right_Window = 0 endif " Increase Vim window width to display vertically split taglist window. " For MS-Windows version of Vim running in a MS-DOS window, this must be " set to 0 otherwise the system may hang due to a Vim limitation. if !exists('Tlist_Inc_Winwidth') if (has('win16') || has('win95')) && !has('gui_running') let Tlist_Inc_Winwidth = 0 else let Tlist_Inc_Winwidth = 1 endif endif " Vertically split taglist window width setting if !exists('Tlist_WinWidth') let Tlist_WinWidth = 30 endif " Horizontally split taglist window height setting if !exists('Tlist_WinHeight') let Tlist_WinHeight = 10 endif " Display tag prototypes or tag names in the taglist window if !exists('Tlist_Display_Prototype') let Tlist_Display_Prototype = 0 endif " Display tag scopes in the taglist window if !exists('Tlist_Display_Tag_Scope') let Tlist_Display_Tag_Scope = 1 endif " Use single left mouse click to jump to a tag. By default this is disabled. " Only double click using the mouse will be processed. if !exists('Tlist_Use_SingleClick') let Tlist_Use_SingleClick = 0 endif " Control whether additional help is displayed as part of the taglist or " not. Also, controls whether empty lines are used to separate the tag " tree. if !exists('Tlist_Compact_Format') let Tlist_Compact_Format = 0 endif " Exit Vim if only the taglist window is currently open. By default, this is " set to zero. if !exists('Tlist_Exit_OnlyWindow') let Tlist_Exit_OnlyWindow = 0 endif " Automatically close the folds for the non-active files in the taglist " window if !exists('Tlist_File_Fold_Auto_Close') let Tlist_File_Fold_Auto_Close = 0 endif " Close the taglist window when a tag is selected if !exists('Tlist_Close_On_Select') let Tlist_Close_On_Select = 0 endif " Automatically update the taglist window to display tags for newly " edited files if !exists('Tlist_Auto_Update') let Tlist_Auto_Update = 1 endif " Automatically highlight the current tag if !exists('Tlist_Auto_Highlight_Tag') let Tlist_Auto_Highlight_Tag = 1 endif " Automatically highlight the current tag on entering a buffer if !exists('Tlist_Highlight_Tag_On_BufEnter') let Tlist_Highlight_Tag_On_BufEnter = 1 endif " Enable fold column to display the folding for the tag tree if !exists('Tlist_Enable_Fold_Column') let Tlist_Enable_Fold_Column = 1 endif " Display the tags for only one file in the taglist window if !exists('Tlist_Show_One_File') let Tlist_Show_One_File = 0 endif if !exists('Tlist_Max_Submenu_Items') let Tlist_Max_Submenu_Items = 20 endif if !exists('Tlist_Max_Tag_Length') let Tlist_Max_Tag_Length = 10 endif " Do not change the name of the taglist title variable. The winmanager " plugin relies on this name to determine the title for the taglist " plugin. let TagList_title = "__Tag_List__" " Taglist debug messages let s:tlist_msg = '' " Define the taglist autocommand to automatically open the taglist window " on Vim startup if g:Tlist_Auto_Open autocmd VimEnter * nested call s:Tlist_Window_Check_Auto_Open() endif " Refresh the taglist if g:Tlist_Process_File_Always autocmd BufEnter * call s:Tlist_Refresh() endif if g:Tlist_Show_Menu autocmd GUIEnter * call s:Tlist_Menu_Init() endif " When the taglist buffer is created when loading a Vim session file, " the taglist buffer needs to be initialized. The BufFilePost event " is used to handle this case. autocmd BufFilePost __Tag_List__ call s:Tlist_Vim_Session_Load() " Define the user commands to manage the taglist window command! -nargs=0 -bar TlistToggle call s:Tlist_Window_Toggle() command! -nargs=0 -bar TlistOpen call s:Tlist_Window_Open() " For backwards compatiblity define the Tlist command command! -nargs=0 -bar Tlist TlistToggle command! -nargs=+ -complete=file TlistAddFiles \ call s:Tlist_Add_Files(<f-args>) command! -nargs=+ -complete=dir TlistAddFilesRecursive \ call s:Tlist_Add_Files_Recursive(<f-args>) command! -nargs=0 -bar TlistClose call s:Tlist_Window_Close() command! -nargs=0 -bar TlistUpdate call s:Tlist_Update_Current_File() command! -nargs=0 -bar TlistHighlightTag call s:Tlist_Window_Highlight_Tag( \ fnamemodify(bufname('%'), ':p'), line('.'), 2, 1) " For backwards compatiblity define the TlistSync command command! -nargs=0 -bar TlistSync TlistHighlightTag command! -nargs=* -complete=buffer TlistShowPrototype \ echo Tlist_Get_Tag_Prototype_By_Line(<f-args>) command! -nargs=* -complete=buffer TlistShowTag \ echo Tlist_Get_Tagname_By_Line(<f-args>) command! -nargs=* -complete=file TlistSessionLoad \ call s:Tlist_Session_Load(<q-args>) command! -nargs=* -complete=file TlistSessionSave \ call s:Tlist_Session_Save(<q-args>) command! -bar TlistLock let Tlist_Auto_Update=0 command! -bar TlistUnlock let Tlist_Auto_Update=1 " Commands for enabling/disabling debug and to display debug messages command! -nargs=? -complete=file -bar TlistDebug \ call s:Tlist_Debug_Enable(<q-args>) command! -nargs=0 -bar TlistUndebug call s:Tlist_Debug_Disable() command! -nargs=0 -bar TlistMessages call s:Tlist_Debug_Show() " Define autocommands to autoload the taglist plugin when needed. " Trick to get the current script ID map <SID>xx <SID>xx let s:tlist_sid = substitute(maparg('<SID>xx'), '<SNR>\(\d\+_\)xx$', \ '\1', '') unmap <SID>xx exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_* source ' . \ escape(expand('<sfile>'), ' ') exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Window_* source ' . \ escape(expand('<sfile>'), ' ') exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Menu_* source ' . \ escape(expand('<sfile>'), ' ') exe 'autocmd FuncUndefined Tlist_* source ' . \ escape(expand('<sfile>'), ' ') exe 'autocmd FuncUndefined TagList_* source ' . \ escape(expand('<sfile>'), ' ') let loaded_taglist = 'fast_load_done' if g:Tlist_Show_Menu && has('gui_running') call s:Tlist_Menu_Init() endif " restore 'cpo' let &cpo = s:cpo_save finishendifif !exists('s:tlist_sid') " Two or more versions of taglist plugin are installed. Don't " load this version of the plugin. finishendifunlet! s:tlist_sidif loaded_taglist != 'fast_load_done' " restore 'cpo' let &cpo = s:cpo_save finishendif" Taglist plugin functionality is availablelet loaded_taglist = 'available'"------------------- end of user configurable options --------------------" Default language specific settings for supported file types and tag types"" Variable name format:"" s:tlist_def_{vim_ftype}_settings" " vim_ftype - Filetype detected by Vim"" Value format:"" <ctags_ftype>;<flag>:<name>;<flag>:<name>;..."" ctags_ftype - File type supported by exuberant ctags" flag - Flag supported by exuberant ctags to generate a tag type" name - Name of the tag type used in the taglist window to display the" tags of this type"" assembly languagelet s:tlist_def_asm_settings = 'asm;d:define;l:label;m:macro;t:type'" aspperl languagelet s:tlist_def_aspperl_settings = 'asp;f:function;s:sub;v:variable'" aspvbs languagelet s:tlist_def_aspvbs_settings = 'asp;f:function;s:sub;v:variable'" awk languagelet s:tlist_def_awk_settings = 'awk;f:function'" beta languagelet s:tlist_def_beta_settings = 'beta;f:fragment;s:slot;v:pattern'
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -