taglist.txt 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501
  1. *taglist.txt* Plugin for browsing source code
  2. Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
  3. For Vim version 6.0 and above
  4. Last change: 2007 May 24
  5. 1. Overview |taglist-intro|
  6. 2. Taglist on the internet |taglist-internet|
  7. 3. Requirements |taglist-requirements|
  8. 4. Installation |taglist-install|
  9. 5. Usage |taglist-using|
  10. 6. Options |taglist-options|
  11. 7. Commands |taglist-commands|
  12. 8. Global functions |taglist-functions|
  13. 9. Extending |taglist-extend|
  14. 10. FAQ |taglist-faq|
  15. 11. License |taglist-license|
  16. 12. Todo |taglist-todo|
  17. ==============================================================================
  18. *taglist-intro*
  19. 1. Overview~
  20. The "Tag List" plugin is a source code browser plugin for Vim. This plugin
  21. allows you to efficiently browse through source code files for different
  22. programming languages. The "Tag List" plugin provides the following features:
  23. * Displays the tags (functions, classes, structures, variables, etc.)
  24. defined in a file in a vertically or horizontally split Vim window.
  25. * In GUI Vim, optionally displays the tags in the Tags drop-down menu and
  26. in the popup menu.
  27. * Automatically updates the taglist window as you switch between
  28. files/buffers. As you open new files, the tags defined in the new files
  29. are added to the existing file list and the tags defined in all the
  30. files are displayed grouped by the filename.
  31. * When a tag name is selected from the taglist window, positions the
  32. cursor at the definition of the tag in the source file.
  33. * Automatically highlights the current tag name.
  34. * Groups the tags by their type and displays them in a foldable tree.
  35. * Can display the prototype and scope of a tag.
  36. * Can optionally display the tag prototype instead of the tag name in the
  37. taglist window.
  38. * The tag list can be sorted either by name or by chronological order.
  39. * Supports the following language files: Assembly, ASP, Awk, Beta, C,
  40. C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp,
  41. Lua, Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang,
  42. SML, Sql, TCL, Verilog, Vim and Yacc.
  43. * Can be easily extended to support new languages. Support for
  44. existing languages can be modified easily.
  45. * Provides functions to display the current tag name in the Vim status
  46. line or the window title bar.
  47. * The list of tags and files in the taglist can be saved and
  48. restored across Vim sessions.
  49. * Provides commands to get the name and prototype of the current tag.
  50. * Runs in both console/terminal and GUI versions of Vim.
  51. * Works with the winmanager plugin. Using the winmanager plugin, you
  52. can use Vim plugins like the file explorer, buffer explorer and the
  53. taglist plugin at the same time like an IDE.
  54. * Can be used in both Unix and MS-Windows systems.
  55. ==============================================================================
  56. *taglist-internet*
  57. 2. Taglist on the internet~
  58. The home page of the taglist plugin is at:
  59. >
  60. http://vim-taglist.sourceforge.net/
  61. <
  62. You can subscribe to the taglist mailing list to post your questions or
  63. suggestions for improvement or to send bug reports. Visit the following page
  64. for subscribing to the mailing list:
  65. >
  66. http://groups.yahoo.com/group/taglist
  67. <
  68. ==============================================================================
  69. *taglist-requirements*
  70. 3. Requirements~
  71. The taglist plugin requires the following:
  72. * Vim version 6.0 and above
  73. * Exuberant ctags 5.0 and above
  74. The taglist plugin will work on all the platforms where the exuberant ctags
  75. utility and Vim are supported (this includes MS-Windows and Unix based
  76. systems).
  77. The taglist plugin relies on the exuberant ctags utility to dynamically
  78. generate the tag listing. The exuberant ctags utility must be installed in
  79. your system to use this plugin. The exuberant ctags utility is shipped with
  80. most of the Linux distributions. You can download the exuberant ctags utility
  81. from
  82. >
  83. http://ctags.sourceforge.net
  84. <
  85. The taglist plugin doesn't use or create a tags file and there is no need to
  86. create a tags file to use this plugin. The taglist plugin will not work with
  87. the GNU ctags or the Unix ctags utility.
  88. This plugin relies on the Vim "filetype" detection mechanism to determine the
  89. type of the current file. You have to turn on the Vim filetype detection by
  90. adding the following line to your .vimrc file:
  91. >
  92. filetype on
  93. <
  94. The taglist plugin will not work if you run Vim in the restricted mode (using
  95. the -Z command-line argument).
  96. The taglist plugin uses the Vim system() function to invoke the exuberant
  97. ctags utility. If Vim is compiled without the system() function then you
  98. cannot use the taglist plugin. Some of the Linux distributions (Suse) compile
  99. Vim without the system() function for security reasons.
  100. ==============================================================================
  101. *taglist-install*
  102. 4. Installation~
  103. 1. Download the taglist.zip file and unzip the files to the $HOME/.vim or the
  104. $HOME/vimfiles or the $VIM/vimfiles directory. After this step, you should
  105. have the following two files (the directory structure should be preserved):
  106. plugin/taglist.vim - main taglist plugin file
  107. doc/taglist.txt - documentation (help) file
  108. Refer to the |add-plugin|and |'runtimepath'| Vim help pages for more
  109. details about installing Vim plugins.
  110. 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or $VIM/vimfiles/doc
  111. directory, start Vim and run the ":helptags ." command to process the
  112. taglist help file. Without this step, you cannot jump to the taglist help
  113. topics.
  114. 3. If the exuberant ctags utility is not present in one of the directories in
  115. the PATH environment variable, then set the 'Tlist_Ctags_Cmd' variable to
  116. point to the location of the exuberant ctags utility (not to the directory)
  117. in the .vimrc file.
  118. 4. If you are running a terminal/console version of Vim and the terminal
  119. doesn't support changing the window width then set the
  120. 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file.
  121. 5. Restart Vim.
  122. 6. You can now use the ":TlistToggle" command to open/close the taglist
  123. window. You can use the ":help taglist" command to get more information
  124. about using the taglist plugin.
  125. To uninstall the taglist plugin, remove the plugin/taglist.vim and
  126. doc/taglist.txt files from the $HOME/.vim or $HOME/vimfiles directory.
  127. ==============================================================================
  128. *taglist-using*
  129. 5. Usage~
  130. The taglist plugin can be used in several different ways.
  131. 1. You can keep the taglist window open during the entire editing session. On
  132. opening the taglist window, the tags defined in all the files in the Vim
  133. buffer list will be displayed in the taglist window. As you edit files, the
  134. tags defined in them will be added to the taglist window. You can select a
  135. tag from the taglist window and jump to it. The current tag will be
  136. highlighted in the taglist window. You can close the taglist window when
  137. you no longer need the window.
  138. 2. You can configure the taglist plugin to process the tags defined in all the
  139. edited files always. In this configuration, even if the taglist window is
  140. closed and the taglist menu is not displayed, the taglist plugin will
  141. processes the tags defined in newly edited files. You can then open the
  142. taglist window only when you need to select a tag and then automatically
  143. close the taglist window after selecting the tag.
  144. 3. You can configure the taglist plugin to display only the tags defined in
  145. the current file in the taglist window. By default, the taglist plugin
  146. displays the tags defined in all the files in the Vim buffer list. As you
  147. switch between files, the taglist window will be refreshed to display only
  148. the tags defined in the current file.
  149. 4. In GUI Vim, you can use the Tags pull-down and popup menu created by the
  150. taglist plugin to display the tags defined in the current file and select a
  151. tag to jump to it. You can use the menu without opening the taglist window.
  152. By default, the Tags menu is disabled.
  153. 5. You can configure the taglist plugin to display the name of the current tag
  154. in the Vim window status line or in the Vim window title bar. For this to
  155. work without the taglist window or menu, you need to configure the taglist
  156. plugin to process the tags defined in a file always.
  157. 6. You can save the tags defined in multiple files to a taglist session file
  158. and load it when needed. You can also configure the taglist plugin to not
  159. update the taglist window when editing new files. You can then manually add
  160. files to the taglist window.
  161. Opening the taglist window~
  162. You can open the taglist window using the ":TlistOpen" or the ":TlistToggle"
  163. commands. The ":TlistOpen" command opens the taglist window and jumps to it.
  164. The ":TlistToggle" command opens or closes (toggle) the taglist window and the
  165. cursor remains in the current window. If the 'Tlist_GainFocus_On_ToggleOpen'
  166. variable is set to 1, then the ":TlistToggle" command opens the taglist window
  167. and moves the cursor to the taglist window.
  168. You can map a key to invoke these commands. For example, the following command
  169. creates a normal mode mapping for the <F8> key to toggle the taglist window.
  170. >
  171. nnoremap <silent> <F8> :TlistToggle<CR>
  172. <
  173. Add the above mapping to your ~/.vimrc or $HOME/_vimrc file.
  174. To automatically open the taglist window on Vim startup, set the
  175. 'Tlist_Auto_Open' variable to 1.
  176. You can also open the taglist window on startup using the following command
  177. line:
  178. >
  179. $ vim +TlistOpen
  180. <
  181. Closing the taglist window~
  182. You can close the taglist window from the taglist window by pressing 'q' or
  183. using the Vim ":q" command. You can also use any of the Vim window commands to
  184. close the taglist window. Invoking the ":TlistToggle" command when the taglist
  185. window is opened, closes the taglist window. You can also use the
  186. ":TlistClose" command to close the taglist window.
  187. To automatically close the taglist window when a tag or file is selected, you
  188. can set the 'Tlist_Close_On_Select' variable to 1. To exit Vim when only the
  189. taglist window is present, set the 'Tlist_Exit_OnlyWindow' variable to 1.
  190. Jumping to a tag or a file~
  191. You can select a tag in the taglist window either by pressing the <Enter> key
  192. or by double clicking the tag name using the mouse. To jump to a tag on a
  193. single mouse click set the 'Tlist_Use_SingleClick' variable to 1.
  194. If the selected file is already opened in a window, then the cursor is moved
  195. to that window. If the file is not currently opened in a window then the file
  196. is opened in the window used by the taglist plugin to show the previously
  197. selected file. If there are no usable windows, then the file is opened in a
  198. new window. The file is not opened in special windows like the quickfix
  199. window, preview window and windows containing buffer with the 'buftype' option
  200. set.
  201. To jump to the tag in a new window, press the 'o' key. To open the file in the
  202. previous window (Ctrl-W_p) use the 'P' key. You can press the 'p' key to jump
  203. to the tag but still keep the cursor in the taglist window (preview).
  204. To open the selected file in a tab, use the 't' key. If the file is already
  205. present in a tab then the cursor is moved to that tab otherwise the file is
  206. opened in a new tab. To jump to a tag in a new tab press Ctrl-t. The taglist
  207. window is automatically opened in the newly created tab.
  208. Instead of jumping to a tag, you can open a file by pressing the <Enter> key
  209. or by double clicking the file name using the mouse.
  210. In the taglist window, you can use the [[ or <Backspace> key to jump to the
  211. beginning of the previous file. You can use the ]] or <Tab> key to jump to the
  212. beginning of the next file. When you reach the first or last file, the search
  213. wraps around and the jumps to the next/previous file.
  214. Highlighting the current tag~
  215. The taglist plugin automatically highlights the name of the current tag in the
  216. taglist window. The Vim |CursorHold| autocmd event is used for this. If the
  217. current tag name is not visible in the taglist window, then the taglist window
  218. contents are scrolled to make that tag name visible. You can also use the
  219. ":TlistHighlightTag" command to force the highlighting of the current tag.
  220. The tag name is highlighted if no activity is performed for |'updatetime'|
  221. milliseconds. The default value for this Vim option is 4 seconds. To avoid
  222. unexpected problems, you should not set the |'updatetime'| option to a very
  223. low value.
  224. To disable the automatic highlighting of the current tag name in the taglist
  225. window, set the 'Tlist_Auto_Highlight_Tag' variable to zero.
  226. When entering a Vim buffer/window, the taglist plugin automatically highlights
  227. the current tag in that buffer/window. If you like to disable the automatic
  228. highlighting of the current tag when entering a buffer, set the
  229. 'Tlist_Highlight_Tag_On_BufEnter' variable to zero.
  230. Adding files to the taglist~
  231. When the taglist window is opened, all the files in the Vim buffer list are
  232. processed and the supported files are added to the taglist. When you edit a
  233. file in Vim, the taglist plugin automatically processes this file and adds it
  234. to the taglist. If you close the taglist window, the tag information in the
  235. taglist is retained.
  236. To process files even when the taglist window is not open, set the
  237. 'Tlist_Process_File_Always' variable to 1.
  238. You can manually add multiple files to the taglist without opening them using
  239. the ":TlistAddFiles" and the ":TlistAddFilesRecursive" commands.
  240. For example, to add all the C files in the /my/project/dir directory to the
  241. taglist, you can use the following command:
  242. >
  243. :TlistAddFiles /my/project/dir/*.c
  244. <
  245. Note that when adding several files with a large number of tags or a large
  246. number of files, it will take several seconds to several minutes for the
  247. taglist plugin to process all the files. You should not interrupt the taglist
  248. plugin by pressing <CTRL-C>.
  249. You can recursively add multiple files from a directory tree using the
  250. ":TlistAddFilesRecursive" command:
  251. >
  252. :TlistAddFilesRecursive /my/project/dir *.c
  253. <
  254. This command takes two arguments. The first argument specifies the directory
  255. from which to recursively add the files. The second optional argument
  256. specifies the wildcard matching pattern for selecting the files to add. The
  257. default pattern is * and all the files are added.
  258. Displaying tags for only one file~
  259. The taglist window displays the tags for all the files in the Vim buffer list
  260. and all the manually added files. To display the tags for only the current
  261. active buffer, set the 'Tlist_Show_One_File' variable to 1.
  262. Removing files from the taglist~
  263. You can remove a file from the taglist window, by pressing the 'd' key when the
  264. cursor is on one of the tags listed for the file in the taglist window. The
  265. removed file will no longer be displayed in the taglist window in the current
  266. Vim session. To again display the tags for the file, open the file in a Vim
  267. window and then use the ":TlistUpdate" command or use ":TlistAddFiles" command
  268. to add the file to the taglist.
  269. When a buffer is removed from the Vim buffer list using the ":bdelete" or the
  270. ":bwipeout" command, the taglist is updated to remove the stored information
  271. for this buffer.
  272. Updating the tags displayed for a file~
  273. The taglist plugin keeps track of the modification time of a file. When the
  274. modification time changes (the file is modified), the taglist plugin
  275. automatically updates the tags listed for that file. The modification time of
  276. a file is checked when you enter a window containing that file or when you
  277. load that file.
  278. You can also update or refresh the tags displayed for a file by pressing the
  279. "u" key in the taglist window. If an existing file is modified, after the file
  280. is saved, the taglist plugin automatically updates the tags displayed for the
  281. file.
  282. You can also use the ":TlistUpdate" command to update the tags for the current
  283. buffer after you made some changes to it. You should save the modified buffer
  284. before you update the taglist window. Otherwise the listed tags will not
  285. include the new tags created in the buffer.
  286. If you have deleted the tags displayed for a file in the taglist window using
  287. the 'd' key, you can again display the tags for that file using the
  288. ":TlistUpdate" command.
  289. Controlling the taglist updates~
  290. To disable the automatic processing of new files or modified files, you can
  291. set the 'Tlist_Auto_Update' variable to zero. When this variable is set to
  292. zero, the taglist is updated only when you use the ":TlistUpdate" command or
  293. the ":TlistAddFiles" or the ":TlistAddFilesRecursive" commands. You can use
  294. this option to control which files are added to the taglist.
  295. You can use the ":TlistLock" command to lock the taglist contents. After this
  296. command is executed, new files are not automatically added to the taglist.
  297. When the taglist is locked, you can use the ":TlistUpdate" command to add the
  298. current file or the ":TlistAddFiles" or ":TlistAddFilesRecursive" commands to
  299. add new files to the taglist. To unlock the taglist, use the ":TlistUnlock"
  300. command.
  301. Displaying the tag prototype~
  302. To display the prototype of the tag under the cursor in the taglist window,
  303. press the space bar. If you place the cursor on a tag name in the taglist
  304. window, then the tag prototype is displayed at the Vim status line after
  305. |'updatetime'| milliseconds. The default value for the |'updatetime'| Vim
  306. option is 4 seconds.
  307. You can get the name and prototype of a tag without opening the taglist window
  308. and the taglist menu using the ":TlistShowTag" and the ":TlistShowPrototype"
  309. commands. These commands will work only if the current file is already present
  310. in the taglist. To use these commands without opening the taglist window, set
  311. the 'Tlist_Process_File_Always' variable to 1.
  312. You can use the ":TlistShowTag" command to display the name of the tag at or
  313. before the specified line number in the specified file. If the file name and
  314. line number are not supplied, then this command will display the name of the
  315. current tag. For example,
  316. >
  317. :TlistShowTag
  318. :TlistShowTag myfile.java 100
  319. <
  320. You can use the ":TlistShowPrototype" command to display the prototype of the
  321. tag at or before the specified line number in the specified file. If the file
  322. name and the line number are not supplied, then this command will display the
  323. prototype of the current tag. For example,
  324. >
  325. :TlistShowPrototype
  326. :TlistShowPrototype myfile.c 50
  327. <
  328. In the taglist window, when the mouse is moved over a tag name, the tag
  329. prototype is displayed in a balloon. This works only in GUI versions where
  330. balloon evaluation is supported.
  331. Taglist window contents~
  332. The taglist window contains the tags defined in various files in the taglist
  333. grouped by the filename and by the tag type (variable, function, class, etc.).
  334. For tags with scope information (like class members, structures inside
  335. structures, etc.), the scope information is displayed in square brackets "[]"
  336. after the tag name.
  337. The contents of the taglist buffer/window are managed by the taglist plugin.
  338. The |'filetype'| for the taglist buffer is set to 'taglist'. The Vim
  339. |'modifiable'| option is turned off for the taglist buffer. You should not
  340. manually edit the taglist buffer, by setting the |'modifiable'| flag. If you
  341. manually edit the taglist buffer contents, then the taglist plugin will be out
  342. of sync with the taglist buffer contents and the plugin will no longer work
  343. correctly. To redisplay the taglist buffer contents again, close the taglist
  344. window and reopen it.
  345. Opening and closing the tag and file tree~
  346. In the taglist window, the tag names are displayed as a foldable tree using
  347. the Vim folding support. You can collapse the tree using the '-' key or using
  348. the Vim |zc| fold command. You can open the tree using the '+' key or using
  349. the Vim |zo| fold command. You can open all the folds using the '*' key or
  350. using the Vim |zR| fold command. You can also use the mouse to open/close the
  351. folds. You can close all the folds using the '=' key. You should not manually
  352. create or delete the folds in the taglist window.
  353. To automatically close the fold for the inactive files/buffers and open only
  354. the fold for the current buffer in the taglist window, set the
  355. 'Tlist_File_Fold_Auto_Close' variable to 1.
  356. Sorting the tags for a file~
  357. The tags displayed in the taglist window can be sorted either by their name or
  358. by their chronological order. The default sorting method is by the order in
  359. which the tags appear in a file. You can change the default sort method by
  360. setting the 'Tlist_Sort_Type' variable to either "name" or "order". You can
  361. sort the tags by their name by pressing the "s" key in the taglist window. You
  362. can again sort the tags by their chronological order using the "s" key. Each
  363. file in the taglist window can be sorted using different order.
  364. Zooming in and out of the taglist window~
  365. You can press the 'x' key in the taglist window to maximize the taglist
  366. window width/height. The window will be maximized to the maximum possible
  367. width/height without closing the other existing windows. You can again press
  368. 'x' to restore the taglist window to the default width/height.
  369. *taglist-session*
  370. Taglist Session~
  371. A taglist session refers to the group of files and their tags stored in the
  372. taglist in a Vim session.
  373. You can save and restore a taglist session (and all the displayed tags) using
  374. the ":TlistSessionSave" and ":TlistSessionLoad" commands.
  375. To save the information about the tags and files in the taglist to a file, use
  376. the ":TlistSessionSave" command and specify the filename:
  377. >
  378. :TlistSessionSave <file name>
  379. <
  380. To load a saved taglist session, use the ":TlistSessionLoad" command: >
  381. :TlistSessionLoad <file name>
  382. <
  383. When you load a taglist session file, the tags stored in the file will be
  384. added to the tags already stored in the taglist.
  385. The taglist session feature can be used to save the tags for large files or a
  386. group of frequently used files (like a project). By using the taglist session
  387. file, you can minimize the amount to time it takes to load/refresh the taglist
  388. for multiple files.
  389. You can create more than one taglist session file for multiple groups of
  390. files.
  391. Displaying the tag name in the Vim status line or the window title bar~
  392. You can use the Tlist_Get_Tagname_By_Line() function provided by the taglist
  393. plugin to display the current tag name in the Vim status line or the window
  394. title bar. Similarly, you can use the Tlist_Get_Tag_Prototype_By_Line()
  395. function to display the current tag prototype in the Vim status line or the
  396. window title bar.
  397. For example, the following command can be used to display the current tag name
  398. in the status line:
  399. >
  400. :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)
  401. <
  402. The following command can be used to display the current tag name in the
  403. window title bar:
  404. >
  405. :set title titlestring=%<%f\ %([%{Tlist_Get_Tagname_By_Line()}]%)
  406. <
  407. Note that the current tag name can be displayed only after the file is
  408. processed by the taglist plugin. For this, you have to either set the
  409. 'Tlist_Process_File_Always' variable to 1 or open the taglist window or use
  410. the taglist menu. For more information about configuring the Vim status line,
  411. refer to the documentation for the Vim |'statusline'| option.
  412. Changing the taglist window highlighting~
  413. The following Vim highlight groups are defined and used to highlight the
  414. various entities in the taglist window:
  415. TagListTagName - Used for tag names
  416. TagListTagScope - Used for tag scope
  417. TagListTitle - Used for tag titles
  418. TagListComment - Used for comments
  419. TagListFileName - Used for filenames
  420. By default, these highlight groups are linked to the standard Vim highlight
  421. groups. If you want to change the colors used for these highlight groups,
  422. prefix the highlight group name with 'My' and define it in your .vimrc or
  423. .gvimrc file: MyTagListTagName, MyTagListTagScope, MyTagListTitle,
  424. MyTagListComment and MyTagListFileName. For example, to change the colors
  425. used for tag names, you can use the following command:
  426. >
  427. :highlight MyTagListTagName guifg=blue ctermfg=blue
  428. <
  429. Controlling the taglist window~
  430. To use a horizontally split taglist window, instead of a vertically split
  431. window, set the 'Tlist_Use_Horiz_Window' variable to 1.
  432. To use a vertically split taglist window on the rightmost side of the Vim
  433. window, set the 'Tlist_Use_Right_Window' variable to 1.
  434. You can specify the width of the vertically split taglist window, by setting
  435. the 'Tlist_WinWidth' variable. You can specify the height of the horizontally
  436. split taglist window, by setting the 'Tlist_WinHeight' variable.
  437. When opening a vertically split taglist window, the Vim window width is
  438. increased to accommodate the new taglist window. When the taglist window is
  439. closed, the Vim window is reduced. To disable this, set the
  440. 'Tlist_Inc_Winwidth' variable to zero.
  441. To reduce the number of empty lines in the taglist window, set the
  442. 'Tlist_Compact_Format' variable to 1.
  443. To not display the Vim fold column in the taglist window, set the
  444. 'Tlist_Enable_Fold_Column' variable to zero.
  445. To display the tag prototypes instead of the tag names in the taglist window,
  446. set the 'Tlist_Display_Prototype' variable to 1.
  447. To not display the scope of the tags next to the tag names, set the
  448. 'Tlist_Display_Tag_Scope' variable to zero.
  449. *taglist-keys*
  450. Taglist window key list~
  451. The following table lists the description of the keys that can be used
  452. in the taglist window.
  453. Key Description~
  454. <CR> Jump to the location where the tag under cursor is
  455. defined.
  456. o Jump to the location where the tag under cursor is
  457. defined in a new window.
  458. P Jump to the tag in the previous (Ctrl-W_p) window.
  459. p Display the tag definition in the file window and
  460. keep the cursor in the taglist window itself.
  461. t Jump to the tag in a new tab. If the file is already
  462. opened in a tab, move to that tab.
  463. Ctrl-t Jump to the tag in a new tab.
  464. <Space> Display the prototype of the tag under the cursor.
  465. For file names, display the full path to the file,
  466. file type and the number of tags. For tag types, display the
  467. tag type and the number of tags.
  468. u Update the tags listed in the taglist window
  469. s Change the sort order of the tags (by name or by order)
  470. d Remove the tags for the file under the cursor
  471. x Zoom-in or Zoom-out the taglist window
  472. + Open a fold
  473. - Close a fold
  474. * Open all folds
  475. = Close all folds
  476. [[ Jump to the beginning of the previous file
  477. <Backspace> Jump to the beginning of the previous file
  478. ]] Jump to the beginning of the next file
  479. <Tab> Jump to the beginning of the next file
  480. q Close the taglist window
  481. <F1> Display help
  482. The above keys will work in both the normal mode and the insert mode.
  483. *taglist-menu*
  484. Taglist menu~
  485. When using GUI Vim, the taglist plugin can display the tags defined in the
  486. current file in the drop-down menu and the popup menu. By default, this
  487. feature is turned off. To turn on this feature, set the 'Tlist_Show_Menu'
  488. variable to 1.
  489. You can jump to a tag by selecting the tag name from the menu. You can use the
  490. taglist menu independent of the taglist window i.e. you don't need to open the
  491. taglist window to get the taglist menu.
  492. When you switch between files/buffers, the taglist menu is automatically
  493. updated to display the tags defined in the current file/buffer.
  494. The tags are grouped by their type (variables, functions, classes, methods,
  495. etc.) and displayed as a separate sub-menu for each type. If all the tags
  496. defined in a file are of the same type (e.g. functions), then the sub-menu is
  497. not used.
  498. If the number of items in a tag type submenu exceeds the value specified by
  499. the 'Tlist_Max_Submenu_Items' variable, then the submenu will be split into
  500. multiple submenus. The default setting for 'Tlist_Max_Submenu_Items' is 25.
  501. The first and last tag names in the submenu are used to form the submenu name.
  502. The menu items are prefixed by alpha-numeric characters for easy selection by
  503. keyboard.
  504. If the popup menu support is enabled (the |'mousemodel'| option contains
  505. "popup"), then the tags menu is added to the popup menu. You can access
  506. the popup menu by right clicking on the GUI window.
  507. You can regenerate the tags menu by selecting the 'Tags->Refresh menu' entry.
  508. You can sort the tags listed in the menu either by name or by order by
  509. selecting the 'Tags->Sort menu by->Name/Order' menu entry.
  510. You can tear-off the Tags menu and keep it on the side of the Vim window
  511. for quickly locating the tags.
  512. Using the taglist plugin with the winmanager plugin~
  513. You can use the taglist plugin with the winmanager plugin. This will allow you
  514. to use the file explorer, buffer explorer and the taglist plugin at the same
  515. time in different windows. To use the taglist plugin with the winmanager
  516. plugin, set 'TagList' in the 'winManagerWindowLayout' variable. For example,
  517. to use the file explorer plugin and the taglist plugin at the same time, use
  518. the following setting: >
  519. let winManagerWindowLayout = 'FileExplorer|TagList'
  520. <
  521. Getting help~
  522. If you have installed the taglist help file (this file), then you can use the
  523. Vim ":help taglist-<keyword>" command to get help on the various taglist
  524. topics.
  525. You can press the <F1> key in the taglist window to display the help
  526. information about using the taglist window. If you again press the <F1> key,
  527. the help information is removed from the taglist window.
  528. *taglist-debug*
  529. Debugging the taglist plugin~
  530. You can use the ":TlistDebug" command to enable logging of the debug messages
  531. from the taglist plugin. To display the logged debug messages, you can use the
  532. ":TlistMessages" command. To disable the logging of the debug messages, use
  533. the ":TlistUndebug" command.
  534. You can specify a file name to the ":TlistDebug" command to log the debug
  535. messages to a file. Otherwise, the debug messages are stored in a script-local
  536. variable. In the later case, to minimize memory usage, only the last 3000
  537. characters from the debug messages are stored.
  538. ==============================================================================
  539. *taglist-options*
  540. 6. Options~
  541. A number of Vim variables control the behavior of the taglist plugin. These
  542. variables are initialized to a default value. By changing these variables you
  543. can change the behavior of the taglist plugin. You need to change these
  544. settings only if you want to change the behavior of the taglist plugin. You
  545. should use the |:let| command in your .vimrc file to change the setting of any
  546. of these variables.
  547. The configurable taglist variables are listed below. For a detailed
  548. description of these variables refer to the text below this table.
  549. |'Tlist_Auto_Highlight_Tag'| Automatically highlight the current tag in the
  550. taglist.
  551. |'Tlist_Auto_Open'| Open the taglist window when Vim starts.
  552. |'Tlist_Auto_Update'| Automatically update the taglist to include
  553. newly edited files.
  554. |'Tlist_Close_On_Select'| Close the taglist window when a file or tag is
  555. selected.
  556. |'Tlist_Compact_Format'| Remove extra information and blank lines from
  557. the taglist window.
  558. |'Tlist_Ctags_Cmd'| Specifies the path to the ctags utility.
  559. |'Tlist_Display_Prototype'| Show prototypes and not tags in the taglist
  560. window.
  561. |'Tlist_Display_Tag_Scope'| Show tag scope next to the tag name.
  562. |'Tlist_Enable_Fold_Column'| Show the fold indicator column in the taglist
  563. window.
  564. |'Tlist_Exit_OnlyWindow'| Close Vim if the taglist is the only window.
  565. |'Tlist_File_Fold_Auto_Close'| Close tag folds for inactive buffers.
  566. |'Tlist_GainFocus_On_ToggleOpen'|
  567. Jump to taglist window on open.
  568. |'Tlist_Highlight_Tag_On_BufEnter'|
  569. On entering a buffer, automatically highlight
  570. the current tag.
  571. |'Tlist_Inc_Winwidth'| Increase the Vim window width to accommodate
  572. the taglist window.
  573. |'Tlist_Max_Submenu_Items'| Maximum number of items in a tags sub-menu.
  574. |'Tlist_Max_Tag_Length'| Maximum tag length used in a tag menu entry.
  575. |'Tlist_Process_File_Always'| Process files even when the taglist window is
  576. closed.
  577. |'Tlist_Show_Menu'| Display the tags menu.
  578. |'Tlist_Show_One_File'| Show tags for the current buffer only.
  579. |'Tlist_Sort_Type'| Sort method used for arranging the tags.
  580. |'Tlist_Use_Horiz_Window'| Use a horizontally split window for the
  581. taglist window.
  582. |'Tlist_Use_Right_Window'| Place the taglist window on the right side.
  583. |'Tlist_Use_SingleClick'| Single click on a tag jumps to it.
  584. |'Tlist_WinHeight'| Horizontally split taglist window height.
  585. |'Tlist_WinWidth'| Vertically split taglist window width.
  586. *'Tlist_Auto_Highlight_Tag'*
  587. Tlist_Auto_Highlight_Tag~
  588. The taglist plugin will automatically highlight the current tag in the taglist
  589. window. If you want to disable this, then you can set the
  590. 'Tlist_Auto_Highlight_Tag' variable to zero. Note that even though the current
  591. tag highlighting is disabled, the tags for a new file will still be added to
  592. the taglist window.
  593. >
  594. let Tlist_Auto_Highlight_Tag = 0
  595. <
  596. With the above variable set to 1, you can use the ":TlistHighlightTag" command
  597. to highlight the current tag.
  598. *'Tlist_Auto_Open'*
  599. Tlist_Auto_Open~
  600. To automatically open the taglist window, when you start Vim, you can set the
  601. 'Tlist_Auto_Open' variable to 1. By default, this variable is set to zero and
  602. the taglist window will not be opened automatically on Vim startup.
  603. >
  604. let Tlist_Auto_Open = 1
  605. <
  606. The taglist window is opened only when a supported type of file is opened on
  607. Vim startup. For example, if you open text files, then the taglist window will
  608. not be opened.
  609. *'Tlist_Auto_Update'*
  610. Tlist_Auto_Update~
  611. When a new file is edited, the tags defined in the file are automatically
  612. processed and added to the taglist. To stop adding new files to the taglist,
  613. set the 'Tlist_Auto_Update' variable to zero. By default, this variable is set
  614. to 1.
  615. >
  616. let Tlist_Auto_Update = 0
  617. <
  618. With the above variable set to 1, you can use the ":TlistUpdate" command to
  619. add the tags defined in the current file to the taglist.
  620. *'Tlist_Close_On_Select'*
  621. Tlist_Close_On_Select~
  622. If you want to close the taglist window when a file or tag is selected, then
  623. set the 'Tlist_Close_On_Select' variable to 1. By default, this variable is
  624. set zero and when you select a tag or file from the taglist window, the window
  625. is not closed.
  626. >
  627. let Tlist_Close_On_Select = 1
  628. <
  629. *'Tlist_Compact_Format'*
  630. Tlist_Compact_Format~
  631. By default, empty lines are used to separate different tag types displayed for
  632. a file and the tags displayed for different files in the taglist window. If
  633. you want to display as many tags as possible in the taglist window, you can
  634. set the 'Tlist_Compact_Format' variable to 1 to get a compact display.
  635. >
  636. let Tlist_Compact_Format = 1
  637. <
  638. *'Tlist_Ctags_Cmd'*
  639. Tlist_Ctags_Cmd~
  640. The 'Tlist_Ctags_Cmd' variable specifies the location (path) of the exuberant
  641. ctags utility. If exuberant ctags is present in any one of the directories in
  642. the PATH environment variable, then there is no need to set this variable.
  643. The exuberant ctags tool can be installed under different names. When the
  644. taglist plugin starts up, if the 'Tlist_Ctags_Cmd' variable is not set, it
  645. checks for the names exuberant-ctags, exctags, ctags, ctags.exe and tags in
  646. the PATH environment variable. If any one of the named executable is found,
  647. then the Tlist_Ctags_Cmd variable is set to that name.
  648. If exuberant ctags is not present in one of the directories specified in the
  649. PATH environment variable, then set this variable to point to the location of
  650. the ctags utility in your system. Note that this variable should point to the
  651. fully qualified exuberant ctags location and NOT to the directory in which
  652. exuberant ctags is installed. If the exuberant ctags tool is not found in
  653. either PATH or in the specified location, then the taglist plugin will not be
  654. loaded. Examples:
  655. >
  656. let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe'
  657. let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
  658. <
  659. *'Tlist_Display_Prototype'*
  660. Tlist_Display_Prototype~
  661. By default, only the tag name will be displayed in the taglist window. If you
  662. like to see tag prototypes instead of names, set the 'Tlist_Display_Prototype'
  663. variable to 1. By default, this variable is set to zero and only tag names
  664. will be displayed.
  665. >
  666. let Tlist_Display_Prototype = 1
  667. <
  668. *'Tlist_Display_Tag_Scope'*
  669. Tlist_Display_Tag_Scope~
  670. By default, the scope of a tag (like a C++ class) will be displayed in
  671. square brackets next to the tag name. If you don't want the tag scopes
  672. to be displayed, then set the 'Tlist_Display_Tag_Scope' to zero. By default,
  673. this variable is set to 1 and the tag scopes will be displayed.
  674. >
  675. let Tlist_Display_Tag_Scope = 0
  676. <
  677. *'Tlist_Enable_Fold_Column'*
  678. Tlist_Enable_Fold_Column~
  679. By default, the Vim fold column is enabled and displayed in the taglist
  680. window. If you wish to disable this (for example, when you are working with a
  681. narrow Vim window or terminal), you can set the 'Tlist_Enable_Fold_Column'
  682. variable to zero.
  683. >
  684. let Tlist_Enable_Fold_Column = 1
  685. <
  686. *'Tlist_Exit_OnlyWindow'*
  687. Tlist_Exit_OnlyWindow~
  688. If you want to exit Vim if only the taglist window is currently opened, then
  689. set the 'Tlist_Exit_OnlyWindow' variable to 1. By default, this variable is
  690. set to zero and the Vim instance will not be closed if only the taglist window
  691. is present.
  692. >
  693. let Tlist_Exit_OnlyWindow = 1
  694. <
  695. *'Tlist_File_Fold_Auto_Close'*
  696. Tlist_File_Fold_Auto_Close~
  697. By default, the tags tree displayed in the taglist window for all the files is
  698. opened. You can close/fold the tags tree for the files manually. To
  699. automatically close the tags tree for inactive files, you can set the
  700. 'Tlist_File_Fold_Auto_Close' variable to 1. When this variable is set to 1,
  701. the tags tree for the current buffer is automatically opened and for all the
  702. other buffers is closed.
  703. >
  704. let Tlist_File_Fold_Auto_Close = 1
  705. <
  706. *'Tlist_GainFocus_On_ToggleOpen'*
  707. Tlist_GainFocus_On_ToggleOpen~
  708. When the taglist window is opened using the ':TlistToggle' command, this
  709. option controls whether the cursor is moved to the taglist window or remains
  710. in the current window. By default, this option is set to 0 and the cursor
  711. remains in the current window. When this variable is set to 1, the cursor
  712. moves to the taglist window after opening the taglist window.
  713. >
  714. let Tlist_GainFocus_On_ToggleOpen = 1
  715. <
  716. *'Tlist_Highlight_Tag_On_BufEnter'*
  717. Tlist_Highlight_Tag_On_BufEnter~
  718. When you enter a Vim buffer/window, the current tag in that buffer/window is
  719. automatically highlighted in the taglist window. If the current tag name is
  720. not visible in the taglist window, then the taglist window contents are
  721. scrolled to make that tag name visible. If you like to disable the automatic
  722. highlighting of the current tag when entering a buffer, you can set the
  723. 'Tlist_Highlight_Tag_On_BufEnter' variable to zero. The default setting for
  724. this variable is 1.
  725. >
  726. let Tlist_Highlight_Tag_On_BufEnter = 0
  727. <
  728. *'Tlist_Inc_Winwidth'*
  729. Tlist_Inc_Winwidth~
  730. By default, when the width of the window is less than 100 and a new taglist
  731. window is opened vertically, then the window width is increased by the value
  732. set in the 'Tlist_WinWidth' variable to accommodate the new window. The value
  733. of this variable is used only if you are using a vertically split taglist
  734. window.
  735. If your terminal doesn't support changing the window width from Vim (older
  736. version of xterm running in a Unix system) or if you see any weird problems in
  737. the screen due to the change in the window width or if you prefer not to
  738. adjust the window width then set the 'Tlist_Inc_Winwidth' variable to zero.
  739. CAUTION: If you are using the MS-Windows version of Vim in a MS-DOS command
  740. window then you must set this variable to zero, otherwise the system may hang
  741. due to a Vim limitation (explained in :help win32-problems)
  742. >
  743. let Tlist_Inc_Winwidth = 0
  744. <
  745. *'Tlist_Max_Submenu_Items'*
  746. Tlist_Max_Submenu_Items~
  747. If a file contains too many tags of a particular type (function, variable,
  748. class, etc.), greater than that specified by the 'Tlist_Max_Submenu_Items'
  749. variable, then the menu for that tag type will be split into multiple
  750. sub-menus. The default setting for the 'Tlist_Max_Submenu_Items' variable is
  751. 25. This can be changed by setting the 'Tlist_Max_Submenu_Items' variable:
  752. >
  753. let Tlist_Max_Submenu_Items = 20
  754. <
  755. The name of the submenu is formed using the names of the first and the last
  756. tag entries in that submenu.
  757. *'Tlist_Max_Tag_Length'*
  758. Tlist_Max_Tag_Length~
  759. Only the first 'Tlist_Max_Tag_Length' characters from the tag names will be
  760. used to form the tag type submenu name. The default value for this variable is
  761. 10. Change the 'Tlist_Max_Tag_Length' setting if you want to include more or
  762. less characters:
  763. >
  764. let Tlist_Max_Tag_Length = 10
  765. <
  766. *'Tlist_Process_File_Always'*
  767. Tlist_Process_File_Always~
  768. By default, the taglist plugin will generate and process the tags defined in
  769. the newly opened files only when the taglist window is opened or when the
  770. taglist menu is enabled. When the taglist window is closed, the taglist plugin
  771. will stop processing the tags for newly opened files.
  772. You can set the 'Tlist_Process_File_Always' variable to 1 to generate the list
  773. of tags for new files even when the taglist window is closed and the taglist
  774. menu is disabled.
  775. >
  776. let Tlist_Process_File_Always = 1
  777. <
  778. To use the ":TlistShowTag" and the ":TlistShowPrototype" commands without the
  779. taglist window and the taglist menu, you should set this variable to 1.
  780. *'Tlist_Show_Menu'*
  781. Tlist_Show_Menu~
  782. When using GUI Vim, you can display the tags defined in the current file in a
  783. menu named "Tags". By default, this feature is turned off. To turn on this
  784. feature, set the 'Tlist_Show_Menu' variable to 1:
  785. >
  786. let Tlist_Show_Menu = 1
  787. <
  788. *'Tlist_Show_One_File'*
  789. Tlist_Show_One_File~
  790. By default, the taglist plugin will display the tags defined in all the loaded
  791. buffers in the taglist window. If you prefer to display the tags defined only
  792. in the current buffer, then you can set the 'Tlist_Show_One_File' to 1. When
  793. this variable is set to 1, as you switch between buffers, the taglist window
  794. will be refreshed to display the tags for the current buffer and the tags for
  795. the previous buffer will be removed.
  796. >
  797. let Tlist_Show_One_File = 1
  798. <
  799. *'Tlist_Sort_Type'*
  800. Tlist_Sort_Type~
  801. The 'Tlist_Sort_Type' variable specifies the sort order for the tags in the
  802. taglist window. The tags can be sorted either alphabetically by their name or
  803. by the order of their appearance in the file (chronological order). By
  804. default, the tag names will be listed by the order in which they are defined
  805. in the file. You can change the sort type (from name to order or from order to
  806. name) by pressing the "s" key in the taglist window. You can also change the
  807. default sort order by setting 'Tlist_Sort_Type' to "name" or "order":
  808. >
  809. let Tlist_Sort_Type = "name"
  810. <
  811. *'Tlist_Use_Horiz_Window'*
  812. Tlist_Use_Horiz_Window~
  813. Be default, the tag names are displayed in a vertically split window. If you
  814. prefer a horizontally split window, then set the 'Tlist_Use_Horiz_Window'
  815. variable to 1. If you are running MS-Windows version of Vim in a MS-DOS
  816. command window, then you should use a horizontally split window instead of a
  817. vertically split window. Also, if you are using an older version of xterm in a
  818. Unix system that doesn't support changing the xterm window width, you should
  819. use a horizontally split window.
  820. >
  821. let Tlist_Use_Horiz_Window = 1
  822. <
  823. *'Tlist_Use_Right_Window'*
  824. Tlist_Use_Right_Window~
  825. By default, the vertically split taglist window will appear on the left hand
  826. side. If you prefer to open the window on the right hand side, you can set the
  827. 'Tlist_Use_Right_Window' variable to 1:
  828. >
  829. let Tlist_Use_Right_Window = 1
  830. <
  831. *'Tlist_Use_SingleClick'*
  832. Tlist_Use_SingleClick~
  833. By default, when you double click on the tag name using the left mouse
  834. button, the cursor will be positioned at the definition of the tag. You
  835. can set the 'Tlist_Use_SingleClick' variable to 1 to jump to a tag when
  836. you single click on the tag name using the mouse. By default this variable
  837. is set to zero.
  838. >
  839. let Tlist_Use_SingleClick = 1
  840. <
  841. Due to a bug in Vim, if you set 'Tlist_Use_SingleClick' to 1 and try to resize
  842. the taglist window using the mouse, then Vim will crash. This problem is fixed
  843. in Vim 6.3 and above. In the meantime, instead of resizing the taglist window
  844. using the mouse, you can use normal Vim window resizing commands to resize the
  845. taglist window.
  846. *'Tlist_WinHeight'*
  847. Tlist_WinHeight~
  848. The default height of the horizontally split taglist window is 10. This can be
  849. changed by modifying the 'Tlist_WinHeight' variable:
  850. >
  851. let Tlist_WinHeight = 20
  852. <
  853. The |'winfixheight'| option is set for the taglist window, to maintain the
  854. height of the taglist window, when new Vim windows are opened and existing
  855. windows are closed.
  856. *'Tlist_WinWidth'*
  857. Tlist_WinWidth~
  858. The default width of the vertically split taglist window is 30. This can be
  859. changed by modifying the 'Tlist_WinWidth' variable:
  860. >
  861. let Tlist_WinWidth = 20
  862. <
  863. Note that the value of the |'winwidth'| option setting determines the minimum
  864. width of the current window. If you set the 'Tlist_WinWidth' variable to a
  865. value less than that of the |'winwidth'| option setting, then Vim will use the
  866. value of the |'winwidth'| option.
  867. When new Vim windows are opened and existing windows are closed, the taglist
  868. plugin will try to maintain the width of the taglist window to the size
  869. specified by the 'Tlist_WinWidth' variable.
  870. ==============================================================================
  871. *taglist-commands*
  872. 7. Commands~
  873. The taglist plugin provides the following ex-mode commands:
  874. |:TlistAddFiles| Add multiple files to the taglist.
  875. |:TlistAddFilesRecursive|
  876. Add files recursively to the taglist.
  877. |:TlistClose| Close the taglist window.
  878. |:TlistDebug| Start logging of taglist debug messages.
  879. |:TlistLock| Stop adding new files to the taglist.
  880. |:TlistMessages| Display the logged taglist plugin debug messages.
  881. |:TlistOpen| Open and jump to the taglist window.
  882. |:TlistSessionSave| Save the information about files and tags in the
  883. taglist to a session file.
  884. |:TlistSessionLoad| Load the information about files and tags stored
  885. in a session file to taglist.
  886. |:TlistShowPrototype| Display the prototype of the tag at or before the
  887. specified line number.
  888. |:TlistShowTag| Display the name of the tag defined at or before the
  889. specified line number.
  890. |:TlistHighlightTag| Highlight the current tag in the taglist window.
  891. |:TlistToggle| Open or close (toggle) the taglist window.
  892. |:TlistUndebug| Stop logging of taglist debug messages.
  893. |:TlistUnlock| Start adding new files to the taglist.
  894. |:TlistUpdate| Update the tags for the current buffer.
  895. *:TlistAddFiles*
  896. :TlistAddFiles {file(s)} [file(s) ...]
  897. Add one or more specified files to the taglist. You can
  898. specify multiple filenames using wildcards. To specify a
  899. file name with space character, you should escape the space
  900. character with a backslash.
  901. Examples:
  902. >
  903. :TlistAddFiles *.c *.cpp
  904. :TlistAddFiles file1.html file2.html
  905. <
  906. If you specify a large number of files, then it will take some
  907. time for the taglist plugin to process all of them. The
  908. specified files will not be edited in a Vim window and will
  909. not be added to the Vim buffer list.
  910. *:TlistAddFilesRecursive*
  911. :TlistAddFilesRecursive {directory} [ {pattern} ]
  912. Add files matching {pattern} recursively from the specified
  913. {directory} to the taglist. If {pattern} is not specified,
  914. then '*' is assumed. To specify the current directory, use "."
  915. for {directory}. To specify a directory name with space
  916. character, you should escape the space character with a
  917. backslash.
  918. Examples:
  919. >
  920. :TlistAddFilesRecursive myproject *.java
  921. :TlistAddFilesRecursive smallproject
  922. <
  923. If large number of files are present in the specified
  924. directory tree, then it will take some time for the taglist
  925. plugin to process all of them.
  926. *:TlistClose*
  927. :TlistClose Close the taglist window. This command can be used from any
  928. one of the Vim windows.
  929. *:TlistDebug*
  930. :TlistDebug [filename]
  931. Start logging of debug messages from the taglist plugin.
  932. If {filename} is specified, then the debug messages are stored
  933. in the specified file. Otherwise, the debug messages are
  934. stored in a script local variable. If the file {filename} is
  935. already present, then it is overwritten.
  936. *:TlistLock*
  937. :TlistLock
  938. Lock the taglist and don't process new files. After this
  939. command is executed, newly edited files will not be added to
  940. the taglist.
  941. *:TlistMessages*
  942. :TlistMessages
  943. Display the logged debug messages from the taglist plugin
  944. in a window. This command works only when logging to a
  945. script-local variable.
  946. *:TlistOpen*
  947. :TlistOpen Open and jump to the taglist window. Creates the taglist
  948. window, if the window is not opened currently. After executing
  949. this command, the cursor is moved to the taglist window. When
  950. the taglist window is opened for the first time, all the files
  951. in the buffer list are processed and the tags defined in them
  952. are displayed in the taglist window.
  953. *:TlistSessionSave*
  954. :TlistSessionSave {filename}
  955. Saves the information about files and tags in the taglist to
  956. the specified file. This command can be used to save and
  957. restore the taglist contents across Vim sessions.
  958. *:TlistSessionLoad*
  959. :TlistSessionLoad {filename}
  960. Load the information about files and tags stored in the
  961. specified session file to the taglist.
  962. *:TlistShowPrototype*
  963. :TlistShowPrototype [filename] [linenumber]
  964. Display the prototype of the tag at or before the specified
  965. line number. If the file name and the line number are not
  966. specified, then the current file name and line number are
  967. used. A tag spans multiple lines starting from the line where
  968. it is defined to the line before the next tag. This command
  969. displays the prototype for the tag for any line number in this
  970. range.
  971. *:TlistShowTag*
  972. :TlistShowTag [filename] [linenumber]
  973. Display the name of the tag defined at or before the specified
  974. line number. If the file name and the line number are not
  975. specified, then the current file name and line number are
  976. used. A tag spans multiple lines starting from the line where
  977. it is defined to the line before the next tag. This command
  978. displays the tag name for any line number in this range.
  979. *:TlistHighlightTag*
  980. :TlistHighlightTag
  981. Highlight the current tag in the taglist window. By default,
  982. the taglist plugin periodically updates the taglist window to
  983. highlight the current tag. This command can be used to force
  984. the taglist plugin to highlight the current tag.
  985. *:TlistToggle*
  986. :TlistToggle Open or close (toggle) the taglist window. Opens the taglist
  987. window, if the window is not opened currently. Closes the
  988. taglist window, if the taglist window is already opened. When
  989. the taglist window is opened for the first time, all the files
  990. in the buffer list are processed and the tags are displayed in
  991. the taglist window. After executing this command, the cursor
  992. is not moved from the current window to the taglist window.
  993. *:TlistUndebug*
  994. :TlistUndebug
  995. Stop logging of debug messages from the taglist plugin.
  996. *:TlistUnlock*
  997. :TlistUnlock
  998. Unlock the taglist and start processing newly edited files.
  999. *:TlistUpdate*
  1000. :TlistUpdate Update the tags information for the current buffer. This
  1001. command can be used to re-process the current file/buffer and
  1002. get the tags information. As the taglist plugin uses the file
  1003. saved in the disk (instead of the file displayed in a Vim
  1004. buffer), you should save a modified buffer before you update
  1005. the taglist. Otherwise the listed tags will not include the
  1006. new tags created in the buffer. You can use this command even
  1007. when the taglist window is not opened.
  1008. ==============================================================================
  1009. *taglist-functions*
  1010. 8. Global functions~
  1011. The taglist plugin provides several global functions that can be used from
  1012. other Vim plugins to interact with the taglist plugin. These functions are
  1013. described below.
  1014. |Tlist_Update_File_Tags()| Update the tags for the specified file
  1015. |Tlist_Get_Tag_Prototype_By_Line()| Return the prototype of the tag at or
  1016. before the specified line number in the
  1017. specified file.
  1018. |Tlist_Get_Tagname_By_Line()| Return the name of the tag at or
  1019. before the specified line number in
  1020. the specified file.
  1021. |Tlist_Set_App()| Set the name of the application
  1022. controlling the taglist window.
  1023. *Tlist_Update_File_Tags()*
  1024. Tlist_Update_File_Tags({filename}, {filetype})
  1025. Update the tags for the file {filename}. The second argument
  1026. specifies the Vim filetype for the file. If the taglist plugin
  1027. has not processed the file previously, then the exuberant
  1028. ctags tool is invoked to generate the tags for the file.
  1029. *Tlist_Get_Tag_Prototype_By_Line()*
  1030. Tlist_Get_Tag_Prototype_By_Line([{filename}, {linenumber}])
  1031. Return the prototype of the tag at or before the specified
  1032. line number in the specified file. If the filename and line
  1033. number are not specified, then the current buffer name and the
  1034. current line number are used.
  1035. *Tlist_Get_Tagname_By_Line()*
  1036. Tlist_Get_Tagname_By_Line([{filename}, {linenumber}])
  1037. Return the name of the tag at or before the specified line
  1038. number in the specified file. If the filename and line number
  1039. are not specified, then the current buffer name and the
  1040. current line number are used.
  1041. *Tlist_Set_App()*
  1042. Tlist_Set_App({appname})
  1043. Set the name of the plugin that controls the taglist plugin
  1044. window and buffer. This can be used to integrate the taglist
  1045. plugin with other Vim plugins.
  1046. For example, the winmanager plugin and the Cream package use
  1047. this function and specify the appname as "winmanager" and
  1048. "cream" respectively.
  1049. By default, the taglist plugin is a stand-alone plugin and
  1050. controls the taglist window and buffer. If the taglist window
  1051. is controlled by an external plugin, then the appname should
  1052. be set appropriately.
  1053. ==============================================================================
  1054. *taglist-extend*
  1055. 9. Extending~
  1056. The taglist plugin supports all the languages supported by the exuberant ctags
  1057. tool, which includes the following languages: Assembly, ASP, Awk, Beta, C,
  1058. C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, Lua,
  1059. Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, SML, Sql,
  1060. TCL, Verilog, Vim and Yacc.
  1061. You can extend the taglist plugin to add support for new languages and also
  1062. modify the support for the above listed languages.
  1063. You should NOT make modifications to the taglist plugin script file to add
  1064. support for new languages. You will lose these changes when you upgrade to the
  1065. next version of the taglist plugin. Instead you should follow the below
  1066. described instructions to extend the taglist plugin.
  1067. You can extend the taglist plugin by setting variables in the .vimrc or _vimrc
  1068. file. The name of these variables depends on the language name and is
  1069. described below.
  1070. Modifying support for an existing language~
  1071. To modify the support for an already supported language, you have to set the
  1072. tlist_xxx_settings variable in the ~/.vimrc or $HOME/_vimrc file. Replace xxx
  1073. with the Vim filetype name for the language file. For example, to modify the
  1074. support for the perl language files, you have to set the tlist_perl_settings
  1075. variable. To modify the support for java files, you have to set the
  1076. tlist_java_settings variable.
  1077. To determine the filetype name used by Vim for a file, use the following
  1078. command in the buffer containing the file:
  1079. :set filetype
  1080. The above command will display the Vim filetype for the current buffer.
  1081. The format of the value set in the tlist_xxx_settings variable is
  1082. <language_name>;flag1:name1;flag2:name2;flag3:name3
  1083. The different fields in the value are separated by the ';' character.
  1084. The first field 'language_name' is the name used by exuberant ctags to refer
  1085. to this language file. This name can be different from the file type name used
  1086. by Vim. For example, for C++, the language name used by ctags is 'c++' but the
  1087. filetype name used by Vim is 'cpp'. To get the list of language names
  1088. supported by exuberant ctags, use the following command:
  1089. $ ctags --list-maps=all
  1090. The remaining fields follow the format "flag:name". The sub-field 'flag' is
  1091. the language specific flag used by exuberant ctags to generate the
  1092. corresponding tags. For example, for the C language, to list only the
  1093. functions, the 'f' flag is used. To get the list of flags supported by
  1094. exuberant ctags for the various languages use the following command:
  1095. $ ctags --list-kinds=all
  1096. The sub-field 'name' specifies the title text to use for displaying the tags
  1097. of a particular type. For example, 'name' can be set to 'functions'. This
  1098. field can be set to any text string name.
  1099. For example, to list only the classes and functions defined in a C++ language
  1100. file, add the following line to your .vimrc file:
  1101. let tlist_cpp_settings = 'c++;c:class;f:function'
  1102. In the above setting, 'cpp' is the Vim filetype name and 'c++' is the name
  1103. used by the exuberant ctags tool. 'c' and 'f' are the flags passed to
  1104. exuberant ctags to list C++ classes and functions and 'class' is the title
  1105. used for the class tags and 'function' is the title used for the function tags
  1106. in the taglist window.
  1107. For example, to display only functions defined in a C file and to use "My
  1108. Functions" as the title for the function tags, use
  1109. let tlist_c_settings = 'c;f:My Functions'
  1110. When you set the tlist_xxx_settings variable, you will override the default
  1111. setting used by the taglist plugin for the 'xxx' language. You cannot add to
  1112. the default options used by the taglist plugin for a particular file type. To
  1113. add to the options used by the taglist plugin for a language, copy the option
  1114. values from the taglist plugin file to your .vimrc file and modify it.
  1115. Adding support for a new language~
  1116. If you want to add support for a new language to the taglist plugin, you need
  1117. to first extend the exuberant ctags tool. For more information about extending
  1118. exuberant ctags, visit the following page:
  1119. http://ctags.sourceforge.net/EXTENDING.html
  1120. To add support for a new language, set the tlist_xxx_settings variable in the
  1121. ~/.vimrc file appropriately as described above. Replace 'xxx' in the variable
  1122. name with the Vim filetype name for the new language.
  1123. For example, to extend the taglist plugin to support the latex language, you
  1124. can use the following line (assuming, you have already extended exuberant
  1125. ctags to support the latex language):
  1126. let tlist_tex_settings='latex;b:bibitem;c:command;l:label'
  1127. With the above line, when you edit files of filetype "tex" in Vim, the taglist
  1128. plugin will invoke the exuberant ctags tool passing the "latex" filetype and
  1129. the flags b, c and l to generate the tags. The text heading 'bibitem',
  1130. 'command' and 'label' will be used in the taglist window for the tags which
  1131. are generated for the flags b, c and l respectively.
  1132. ==============================================================================
  1133. *taglist-faq*
  1134. 10. Frequently Asked Questions~
  1135. Q. The taglist plugin doesn't work. The taglist window is empty and the tags
  1136. defined in a file are not displayed.
  1137. A. Are you using Vim version 6.0 and above? The taglist plugin relies on the
  1138. features supported by Vim version 6.0 and above. You can use the following
  1139. command to get the Vim version:
  1140. >
  1141. $ vim --version
  1142. <
  1143. Are you using exuberant ctags version 5.0 and above? The taglist plugin
  1144. relies on the features supported by exuberant ctags and will not work with
  1145. GNU ctags or the Unix ctags utility. You can use the following command to
  1146. determine whether the ctags installed in your system is exuberant ctags:
  1147. >
  1148. $ ctags --version
  1149. <
  1150. Is exuberant ctags present in one of the directories in your PATH? If not,
  1151. you need to set the Tlist_Ctags_Cmd variable to point to the location of
  1152. exuberant ctags. Use the following Vim command to verify that this is setup
  1153. correctly:
  1154. >
  1155. :echo system(Tlist_Ctags_Cmd . ' --version')
  1156. <
  1157. The above command should display the version information for exuberant
  1158. ctags.
  1159. Did you turn on the Vim filetype detection? The taglist plugin relies on
  1160. the filetype detected by Vim and passes the filetype to the exuberant ctags
  1161. utility to parse the tags. Check the output of the following Vim command:
  1162. >
  1163. :filetype
  1164. <
  1165. The output of the above command should contain "filetype detection:ON".
  1166. To turn on the filetype detection, add the following line to the .vimrc or
  1167. _vimrc file:
  1168. >
  1169. filetype on
  1170. <
  1171. Is your version of Vim compiled with the support for the system() function?
  1172. The following Vim command should display 1:
  1173. >
  1174. :echo exists('*system')
  1175. <
  1176. In some Linux distributions (particularly Suse Linux), the default Vim
  1177. installation is built without the support for the system() function. The
  1178. taglist plugin uses the system() function to invoke the exuberant ctags
  1179. utility. You need to rebuild Vim after enabling the support for the
  1180. system() function. If you use the default build options, the system()
  1181. function will be supported.
  1182. Do you have the |'shellslash'| option set? You can try disabling the
  1183. |'shellslash'| option. When the taglist plugin invokes the exuberant ctags
  1184. utility with the path to the file, if the incorrect slashes are used, then
  1185. you will see errors.
  1186. Check the shell related Vim options values using the following command:
  1187. >
  1188. :set shell? shellcmdflag? shellpipe?
  1189. :set shellquote? shellredir? shellxquote?
  1190. <
  1191. If these options are set in your .vimrc or _vimrc file, try removing those
  1192. lines.
  1193. Are you using a Unix shell in a MS-Windows environment? For example,
  1194. the Unix shell from the MKS-toolkit. Do you have the SHELL environment
  1195. set to point to this shell? You can try resetting the SHELL environment
  1196. variable.
  1197. If you are using a Unix shell on MS-Windows, you should try to use
  1198. exuberant ctags that is compiled for Unix-like environments so that
  1199. exuberant ctags will understand path names with forward slash characters.
  1200. Is your filetype supported by the exuberant ctags utility? The file types
  1201. supported by the exuberant ctags utility are listed in the ctags help. If a
  1202. file type is not supported, you have to extend exuberant ctags. You can use
  1203. the following command to list the filetypes supported by exuberant ctags:
  1204. >
  1205. ctags --list-languages
  1206. <
  1207. Run the following command from the shell prompt and check whether the tags
  1208. defined in your file are listed in the output from exuberant ctags:
  1209. >
  1210. ctags -f - --format=2 --excmd=pattern --fields=nks <filename>
  1211. <
  1212. If you see your tags in the output from the above command, then the
  1213. exuberant ctags utility is properly parsing your file.
  1214. Do you have the .ctags or _ctags or the ctags.cnf file in your home
  1215. directory for specifying default options or for extending exuberant ctags?
  1216. If you do have this file, check the options in this file and make sure
  1217. these options are not interfering with the operation of the taglist plugin.
  1218. If you are using MS-Windows, check the value of the TEMP and TMP
  1219. environment variables. If these environment variables are set to a path
  1220. with space characters in the name, then try using the DOS 8.3 short name
  1221. for the path or set them to a path without the space characters in the
  1222. name. For example, if the temporary directory name is "C:\Documents and
  1223. Settings\xyz\Local Settings\Temp", then try setting the TEMP variable to
  1224. the following:
  1225. >
  1226. set TEMP=C:\DOCUMEN~1\xyz\LOCALS~1\Temp
  1227. <
  1228. If exuberant ctags is installed in a directory with space characters in the
  1229. name, then try adding the directory to the PATH environment variable or try
  1230. setting the 'Tlist_Ctags_Cmd' variable to the shortest path name to ctags
  1231. or try copying the exuberant ctags to a path without space characters in
  1232. the name. For example, if exuberant ctags is installed in the directory
  1233. "C:\Program Files\Ctags", then try setting the 'Tlist_Ctags_Cmd' variable
  1234. as below:
  1235. >
  1236. let Tlist_Ctags_Cmd='C:\Progra~1\Ctags\ctags.exe'
  1237. <
  1238. If you are using a cygwin compiled version of exuberant ctags on MS-Windows,
  1239. make sure that either you have the cygwin compiled sort utility installed
  1240. and available in your PATH or compile exuberant ctags with internal sort
  1241. support. Otherwise, when exuberant ctags sorts the tags output by invoking
  1242. the sort utility, it may end up invoking the MS-Windows version of
  1243. sort.exe, thereby resulting in failure.
  1244. Q. When I try to open the taglist window, I am seeing the following error
  1245. message. How do I fix this problem?
  1246. Taglist: Failed to generate tags for /my/path/to/file
  1247. ctags: illegal option -- -^@usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
  1248. A. The taglist plugin will work only with the exuberant ctags tool. You
  1249. cannot use the GNU ctags or the Unix ctags program with the taglist plugin.
  1250. You will see an error message similar to the one shown above, if you try
  1251. use a non-exuberant ctags program with Vim. To fix this problem, either add
  1252. the exuberant ctags tool location to the PATH environment variable or set
  1253. the 'Tlist_Ctags_Cmd' variable.
  1254. Q. A file has more than one tag with the same name. When I select a tag name
  1255. from the taglist window, the cursor is positioned at the incorrect tag
  1256. location.
  1257. A. The taglist plugin uses the search pattern generated by the exuberant ctags
  1258. utility to position the cursor at the location of a tag definition. If a
  1259. file has more than one tag with the same name and same prototype, then the
  1260. search pattern will be the same. In this case, when searching for the tag
  1261. pattern, the cursor may be positioned at the incorrect location.
  1262. Q. I have made some modifications to my file and introduced new
  1263. functions/classes/variables. I have not yet saved my file. The taglist
  1264. plugin is not displaying the new tags when I update the taglist window.
  1265. A. The exuberant ctags utility will process only files that are present in the
  1266. disk. To list the tags defined in a file, you have to save the file and
  1267. then update the taglist window.
  1268. Q. I have created a ctags file using the exuberant ctags utility for my source
  1269. tree. How do I configure the taglist plugin to use this tags file?
  1270. A. The taglist plugin doesn't use a tags file stored in disk. For every opened
  1271. file, the taglist plugin invokes the exuberant ctags utility to get the
  1272. list of tags dynamically. The Vim system() function is used to invoke
  1273. exuberant ctags and get the ctags output. This function internally uses a
  1274. temporary file to store the output. This file is deleted after the output
  1275. from the command is read. So you will never see the file that contains the
  1276. output of exuberant ctags.
  1277. Q. When I set the |'updatetime'| option to a low value (less than 1000) and if
  1278. I keep pressing a key with the taglist window open, the current buffer
  1279. contents are changed. Why is this?
  1280. A. The taglist plugin uses the |CursorHold| autocmd to highlight the current
  1281. tag. The CursorHold autocmd triggers for every |'updatetime'| milliseconds.
  1282. If the |'updatetime'| option is set to a low value, then the CursorHold
  1283. autocmd will be triggered frequently. As the taglist plugin changes
  1284. the focus to the taglist window to highlight the current tag, this could
  1285. interfere with the key movement resulting in changing the contents of
  1286. the current buffer. The workaround for this problem is to not set the
  1287. |'updatetime'| option to a low value.
  1288. ==============================================================================
  1289. *taglist-license*
  1290. 11. License~
  1291. Permission is hereby granted to use and distribute the taglist plugin, with or
  1292. without modifications, provided that this copyright notice is copied with it.
  1293. Like anything else that's free, taglist.vim is provided *as is* and comes with
  1294. no warranty of any kind, either expressed or implied. In no event will the
  1295. copyright holder be liable for any damamges resulting from the use of this
  1296. software.
  1297. ==============================================================================
  1298. *taglist-todo*
  1299. 12. Todo~
  1300. 1. Group tags according to the scope and display them. For example,
  1301. group all the tags belonging to a C++/Java class
  1302. 2. Support for displaying tags in a modified (not-yet-saved) file.
  1303. 3. Automatically open the taglist window only for selected filetypes.
  1304. For other filetypes, close the taglist window.
  1305. 4. When using the shell from the MKS toolkit, the taglist plugin
  1306. doesn't work.
  1307. 5. The taglist plugin doesn't work with files edited remotely using the
  1308. netrw plugin. The exuberant ctags utility cannot process files over
  1309. scp/rcp/ftp, etc.
  1310. ==============================================================================
  1311. vim:tw=78:ts=8:noet:ft=help: