Version 3.4
1. Introduced a new option 'Tlist_Show_One_File" to display the tags for only the current buffer in the taglist window. 2. Support for not displaying the tags for a user-deleted file in the taglist window. 3. Fix for sharing the mouse single click map with other plugins
This commit is contained in:
parent
e5c430700d
commit
579a5bab88
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
|
Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
|
||||||
For Vim version 6.0 and above
|
For Vim version 6.0 and above
|
||||||
Last change: 2004 June 1
|
Last change: 2004 August 15
|
||||||
|
|
||||||
1. Overview |taglist-intro|
|
1. Overview |taglist-intro|
|
||||||
2. Taglist on the internet |taglist-internet|
|
2. Taglist on the internet |taglist-internet|
|
||||||
|
@ -120,7 +120,7 @@ assumes that the system() Vim function is supported. Make sure that the
|
||||||
2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or
|
2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or
|
||||||
$VIM/doc/vimfiles directory, start Vim and run the ":helptags ."
|
$VIM/doc/vimfiles directory, start Vim and run the ":helptags ."
|
||||||
command to process the taglist help file.
|
command to process the taglist help file.
|
||||||
3. Set the Tlist_Ctags_Cmd variable to point to the location of the
|
3. Set the Tlist_Ctags_Cmd variable to point to the location (path) of the
|
||||||
exuberant ctags utility (not to the directory) in the .vimrc file.
|
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
|
4. If you are running a terminal/console version of Vim and the terminal
|
||||||
doesn't support changing the window width then set the
|
doesn't support changing the window width then set the
|
||||||
|
@ -222,7 +222,8 @@ order using the "s" key.
|
||||||
Removing the tags listed for a file from the taglist window~
|
Removing the tags listed for a file from the taglist window~
|
||||||
You can remove the tags displayed for a file, by pressing the 'd' key
|
You can remove the tags displayed for a file, by pressing the 'd' key
|
||||||
when the cursor is on one of the tags listed for the file in the
|
when the cursor is on one of the tags listed for the file in the
|
||||||
taglist window.
|
taglist window. To again display the tags for the file in the taglist window,
|
||||||
|
use the ':TlistUpdate' command.
|
||||||
|
|
||||||
Zooming in and out of the taglist window~
|
Zooming in and out of the taglist window~
|
||||||
You can press the 'x' key in the taglist window to maximize the taglist
|
You can press the 'x' key in the taglist window to maximize the taglist
|
||||||
|
@ -241,6 +242,10 @@ normal mode mapping for the <F7> key to update the taglist window. >
|
||||||
|
|
||||||
nnoremap <silent> <F7> :TlistUpdate<CR>
|
nnoremap <silent> <F7> :TlistUpdate<CR>
|
||||||
<
|
<
|
||||||
|
If you have deleted the tags displayed for a file in the taglist window using
|
||||||
|
the 'd' key, you can again display the tags for that file using the
|
||||||
|
':TlistUpdate' command.
|
||||||
|
|
||||||
Taglist Session~
|
Taglist Session~
|
||||||
A taglist session refers to the group of files and their tags displayed in the
|
A taglist session refers to the group of files and their tags displayed in the
|
||||||
taglist window in a Vim session.
|
taglist window in a Vim session.
|
||||||
|
@ -343,16 +348,16 @@ need to use the |let| command in your .vimrc file to change the setting of any
|
||||||
of these variables.
|
of these variables.
|
||||||
|
|
||||||
Tlist_Ctags_Cmd~
|
Tlist_Ctags_Cmd~
|
||||||
The 'Tlist_Ctags_Cmd' variable specifies the location of the ctags utility.
|
The 'Tlist_Ctags_Cmd' variable specifies the location (path) of the ctags
|
||||||
The exuberant ctags tool is installed under different names in different
|
utility. The exuberant ctags tool is installed under different names in
|
||||||
installations. When the taglist plugin starts up, it checks for the names
|
different installations. When the taglist plugin starts up, it checks for the
|
||||||
exuberant-ctags, ctags and tags in the PATH environment variable. If any one
|
names exuberant-ctags, ctags, ctags.exe and tags in the PATH environment
|
||||||
of the named executable is found, then Tlist_Ctags_Cmd is set to that name.
|
variable. If any one of the named executable is found, then Tlist_Ctags_Cmd is
|
||||||
Set this variable to point to the location of the ctags utility in your
|
set to that name. Set this variable to point to the location of the ctags
|
||||||
system. Note that this variable should point to the fully qualified exuberant
|
utility in your system. Note that this variable should point to the fully
|
||||||
ctags location and NOT to the directory in which exuberant ctags is installed.
|
qualified exuberant ctags location and NOT to the directory in which exuberant
|
||||||
If the exuberant ctags tool is not found in either PATH or in the specified
|
ctags is installed. If the exuberant ctags tool is not found in either PATH
|
||||||
location, then the taglist plugin will not be loaded.
|
or in the specified location, then the taglist plugin will not be loaded.
|
||||||
>
|
>
|
||||||
let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe'
|
let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe'
|
||||||
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
|
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
|
||||||
|
@ -410,6 +415,16 @@ this variable is set to 1 and the tag scopes will be displayed. >
|
||||||
|
|
||||||
let Tlist_Display_Tag_Scope = 0
|
let Tlist_Display_Tag_Scope = 0
|
||||||
<
|
<
|
||||||
|
Tlist_Show_One_File~
|
||||||
|
By default, the taglist plugin will display tags for all the loaded buffers in
|
||||||
|
the taglist window. If you prefer to display the tags only for the current
|
||||||
|
buffer, then you can set the 'Tlist_Show_One_File' to 1. When this variable is
|
||||||
|
set to 1, as you switch between buffers, the taglist window will be refreshed
|
||||||
|
to display the tags for the current buffer and the tags for the previous
|
||||||
|
buffer will be removed.
|
||||||
|
>
|
||||||
|
let Tlist_Show_One_File = 1
|
||||||
|
<
|
||||||
Tlist_WinWidth~
|
Tlist_WinWidth~
|
||||||
The default width of the vertically split taglist window is 30. This can be
|
The default width of the vertically split taglist window is 30. This can be
|
||||||
changed by modifying the 'Tlist_WinWidth' variable: >
|
changed by modifying the 'Tlist_WinWidth' variable: >
|
||||||
|
@ -748,9 +763,17 @@ A. Are you using Vim version 6.0 and above? The taglist plugin relies on the
|
||||||
variable.
|
variable.
|
||||||
|
|
||||||
Is your filetype supported by the exuberant ctags utility? The file types
|
Is your filetype supported by the exuberant ctags utility? The file types
|
||||||
supported by the exuberant ctags utility is listed in the ctags help. If a
|
supported by the exuberant ctags utility are listed in the ctags help. If a
|
||||||
file type is not supported, you have to extend exuberant ctags.
|
file type is not supported, you have to extend exuberant ctags.
|
||||||
|
|
||||||
|
Run the following command from the shell and see whether you see
|
||||||
|
your tags in the output from exuberant ctags:
|
||||||
|
|
||||||
|
ctags -f - --format=2 --excmd=pattern --fields=nks <filename>
|
||||||
|
|
||||||
|
If you see your tags in the output from the above command, then the
|
||||||
|
exuberant ctags utility is properly parsing your file.
|
||||||
|
|
||||||
Do you have the .ctags or _ctags or the ctags.cnf file in your home
|
Do you have the .ctags or _ctags or the ctags.cnf file in your home
|
||||||
directory for specifying default options or for extending exuberant ctags?
|
directory for specifying default options or for extending exuberant ctags?
|
||||||
If you do have this file, check the options in this file and make sure
|
If you do have this file, check the options in this file and make sure
|
||||||
|
@ -778,6 +801,18 @@ A. The taglist plugin doesn't use the tags file generated by exuberant ctags.
|
||||||
For every opened file, the taglist plugin invokes the exuberant ctags
|
For every opened file, the taglist plugin invokes the exuberant ctags
|
||||||
utility to get the list of tags.
|
utility to get the list of tags.
|
||||||
|
|
||||||
|
Q. When I set the |updatetime| option to a low value (less than 1000) and if I
|
||||||
|
keep pressing a key with the taglist window open, the current buffer
|
||||||
|
contents are changed. Why is this?
|
||||||
|
A. The taglist plugin uses the |CursorHold| autocmd to highlight the current
|
||||||
|
tag. The CursorHold autocmd triggers for every 'updatetime' milliseconds.
|
||||||
|
If the 'updatetime' option is set to a low value, then the CursorHold
|
||||||
|
autocmd will be triggered frequently. As the taglist plugin changes
|
||||||
|
the focus to the taglist window to highlight the current tag, this could
|
||||||
|
interfere with the key movement resulting in changing the contents of
|
||||||
|
the current buffer. The workaround for this problem is to not set the
|
||||||
|
'updatetime' option to a low value.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
*taglist-todo*
|
*taglist-todo*
|
||||||
11. Todo~
|
11. Todo~
|
||||||
|
@ -790,9 +825,11 @@ A. The taglist plugin doesn't use the tags file generated by exuberant ctags.
|
||||||
4. Taglist plugin doesn't work properly with the Vim session support.
|
4. Taglist plugin doesn't work properly with the Vim session support.
|
||||||
When a session with taglist window is saved and restored, the plugin
|
When a session with taglist window is saved and restored, the plugin
|
||||||
doesn't update the window.
|
doesn't update the window.
|
||||||
5. In certain environments like cygwin or using Unix tools in Windows
|
5. When using the shell from the MKS toolkit, the taglist plugin
|
||||||
environment, the taglist plugin doesn't work due to the difference in
|
doesn't work.
|
||||||
the file path separators.
|
6. The taglist plugin doesn't work with files edited remotely using the
|
||||||
|
netrw plugin. The exuberant ctags utility cannot process files over
|
||||||
|
scp/rcp/ftp, etc.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
" File: taglist.vim
|
" File: taglist.vim
|
||||||
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
|
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
|
||||||
" Version: 3.3
|
" Version: 3.4
|
||||||
" Last Modified: May 26, 2004
|
" Last Modified: August 15, 2004
|
||||||
"
|
"
|
||||||
" The "Tag List" plugin is a source code browser plugin for Vim and
|
" The "Tag List" plugin is a source code browser plugin for Vim and
|
||||||
" provides an overview of the structure of source code files and allows
|
" provides an overview of the structure of source code files and allows
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
if exists('loaded_taglist') || &cp
|
if exists('loaded_taglist') || &cp
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let loaded_taglist=1
|
let loaded_taglist='yes'
|
||||||
|
|
||||||
" Location of the exuberant ctags tool
|
" Location of the exuberant ctags tool
|
||||||
if !exists('Tlist_Ctags_Cmd')
|
if !exists('Tlist_Ctags_Cmd')
|
||||||
|
@ -57,15 +57,21 @@ if !exists('Tlist_Ctags_Cmd')
|
||||||
let Tlist_Ctags_Cmd = 'exuberant-ctags'
|
let Tlist_Ctags_Cmd = 'exuberant-ctags'
|
||||||
elseif executable('ctags')
|
elseif executable('ctags')
|
||||||
let Tlist_Ctags_Cmd = 'ctags'
|
let Tlist_Ctags_Cmd = 'ctags'
|
||||||
|
elseif executable('ctags.exe')
|
||||||
|
let Tlist_Ctags_Cmd = 'ctags.exe'
|
||||||
elseif executable('tags')
|
elseif executable('tags')
|
||||||
let Tlist_Ctags_Cmd = 'tags'
|
let Tlist_Ctags_Cmd = 'tags'
|
||||||
else
|
else
|
||||||
echomsg 'Taglist: Exuberant ctags not found in PATH. ' .
|
echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' .
|
||||||
\ 'Plugin is not loaded.'
|
\ 'not found in PATH. Plugin is not loaded.'
|
||||||
|
" Taglist plugin functionality is not available
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Taglist plugin functionality is available
|
||||||
|
let loaded_taglist = 'available'
|
||||||
|
|
||||||
" Tag listing sort type - 'name' or 'order'
|
" Tag listing sort type - 'name' or 'order'
|
||||||
if !exists('Tlist_Sort_Type')
|
if !exists('Tlist_Sort_Type')
|
||||||
let Tlist_Sort_Type = 'order'
|
let Tlist_Sort_Type = 'order'
|
||||||
|
@ -157,6 +163,11 @@ if !exists('Tlist_Enable_Fold_Column')
|
||||||
let Tlist_Enable_Fold_Column = 1
|
let Tlist_Enable_Fold_Column = 1
|
||||||
endif
|
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
|
||||||
|
|
||||||
"------------------- end of user configurable options --------------------
|
"------------------- end of user configurable options --------------------
|
||||||
|
|
||||||
" Initialize the taglist plugin local variables for the supported file types
|
" Initialize the taglist plugin local variables for the supported file types
|
||||||
|
@ -302,6 +313,9 @@ let s:tlist_ftype_count = 0
|
||||||
let s:tlist_app_name = "none"
|
let s:tlist_app_name = "none"
|
||||||
" Are we displaying brief help text
|
" Are we displaying brief help text
|
||||||
let s:tlist_brief_help = 1
|
let s:tlist_brief_help = 1
|
||||||
|
" List of files deleted on user request
|
||||||
|
let s:tlist_deleted_flist = ""
|
||||||
|
let s:tlist_cur_file_idx = -1
|
||||||
" Do not change the name of the taglist title variable. The winmanager plugin
|
" 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.
|
" relies on this name to determine the title for the taglist plugin.
|
||||||
let TagList_title = "__Tag_List__"
|
let TagList_title = "__Tag_List__"
|
||||||
|
@ -440,6 +454,11 @@ endfunction
|
||||||
" Tlist_Skip_File()
|
" Tlist_Skip_File()
|
||||||
" Check whether tag listing is supported for the specified file
|
" Check whether tag listing is supported for the specified file
|
||||||
function! s:Tlist_Skip_File(filename, ftype)
|
function! s:Tlist_Skip_File(filename, ftype)
|
||||||
|
" Skip buffers with no names
|
||||||
|
if a:filename == ''
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
" Skip buffers with filetype not set
|
" Skip buffers with filetype not set
|
||||||
if a:ftype == ''
|
if a:ftype == ''
|
||||||
return 1
|
return 1
|
||||||
|
@ -458,11 +477,6 @@ function! s:Tlist_Skip_File(filename, ftype)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Skip buffers with no names
|
|
||||||
if a:filename == ''
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Skip files which are not readable or files which are not yet stored
|
" Skip files which are not readable or files which are not yet stored
|
||||||
" to the disk
|
" to the disk
|
||||||
if !filereadable(a:filename)
|
if !filereadable(a:filename)
|
||||||
|
@ -662,6 +676,11 @@ endfunction
|
||||||
" Tlist_Remove_File_From_Display
|
" Tlist_Remove_File_From_Display
|
||||||
" Remove the specified file from display
|
" Remove the specified file from display
|
||||||
function! s:Tlist_Remove_File_From_Display(fidx)
|
function! s:Tlist_Remove_File_From_Display(fidx)
|
||||||
|
" If the file is not visible then no need to remove it
|
||||||
|
if !s:tlist_{a:fidx}_visible
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
" Remove the tags displayed for the specified file from the window
|
" Remove the tags displayed for the specified file from the window
|
||||||
let start = s:tlist_{a:fidx}_start
|
let start = s:tlist_{a:fidx}_start
|
||||||
" Include the empty line after the last line also
|
" Include the empty line after the last line also
|
||||||
|
@ -672,9 +691,7 @@ function! s:Tlist_Remove_File_From_Display(fidx)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
setlocal modifiable
|
setlocal modifiable
|
||||||
|
|
||||||
exe 'silent! ' . start . ',' . end . 'delete _'
|
exe 'silent! ' . start . ',' . end . 'delete _'
|
||||||
|
|
||||||
setlocal nomodifiable
|
setlocal nomodifiable
|
||||||
|
|
||||||
" Correct the start and end line offsets for all the files following
|
" Correct the start and end line offsets for all the files following
|
||||||
|
@ -684,7 +701,8 @@ endfunction
|
||||||
|
|
||||||
" Tlist_Remove_File
|
" Tlist_Remove_File
|
||||||
" Remove the file under the cursor or the specified file index
|
" Remove the file under the cursor or the specified file index
|
||||||
function! s:Tlist_Remove_File(file_idx)
|
" user_request - User requested to remove the file from taglist
|
||||||
|
function! s:Tlist_Remove_File(file_idx, user_request)
|
||||||
let fidx = a:file_idx
|
let fidx = a:file_idx
|
||||||
|
|
||||||
if fidx == -1
|
if fidx == -1
|
||||||
|
@ -696,6 +714,13 @@ function! s:Tlist_Remove_File(file_idx)
|
||||||
|
|
||||||
call s:Tlist_Remove_File_From_Display(fidx)
|
call s:Tlist_Remove_File_From_Display(fidx)
|
||||||
|
|
||||||
|
if a:user_request
|
||||||
|
" As the user requested to remove the file from taglist,
|
||||||
|
" add it to the removed list
|
||||||
|
let s:tlist_deleted_flist = s:tlist_deleted_flist .
|
||||||
|
\ s:tlist_{fidx}_filename . "\n"
|
||||||
|
endif
|
||||||
|
|
||||||
call s:Tlist_Discard_FileInfo(fidx)
|
call s:Tlist_Discard_FileInfo(fidx)
|
||||||
|
|
||||||
" Shift all the file variables by one index
|
" Shift all the file variables by one index
|
||||||
|
@ -747,18 +772,20 @@ function! s:Tlist_Remove_File(file_idx)
|
||||||
|
|
||||||
" Reduce the number of files displayed
|
" Reduce the number of files displayed
|
||||||
let s:tlist_file_count = s:tlist_file_count - 1
|
let s:tlist_file_count = s:tlist_file_count - 1
|
||||||
|
|
||||||
|
if g:Tlist_Show_One_File
|
||||||
|
" If the tags for only one file are displayed and if we just
|
||||||
|
" now removed the file, then invalidate the current file idx
|
||||||
|
if s:tlist_cur_file_idx == fidx
|
||||||
|
let s:tlist_cur_file_idx = -1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Tlist_Open_Window
|
" Tlist_Open_Window
|
||||||
" Create a new taglist window. If it is already open, jump to it
|
" Create a new taglist window. If it is already open, jump to it
|
||||||
function! s:Tlist_Open_Window()
|
function! s:Tlist_Open_Window()
|
||||||
" If used with winmanager don't open windows. Winmanager will handle
|
|
||||||
" the window/buffer management
|
|
||||||
if s:tlist_app_name == "winmanager"
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the window is open, jump to it
|
" If the window is open, jump to it
|
||||||
let winnum = bufwinnr(g:TagList_title)
|
let winnum = bufwinnr(g:TagList_title)
|
||||||
if winnum != -1
|
if winnum != -1
|
||||||
|
@ -769,6 +796,12 @@ function! s:Tlist_Open_Window()
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" If used with winmanager don't open windows. Winmanager will handle
|
||||||
|
" the window/buffer management
|
||||||
|
if s:tlist_app_name == "winmanager"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
" Create a new window. If user prefers a horizontal window, then open
|
" Create a new window. If user prefers a horizontal window, then open
|
||||||
" a horizontally split window. Otherwise open a vertically split
|
" a horizontally split window. Otherwise open a vertically split
|
||||||
" window
|
" window
|
||||||
|
@ -812,6 +845,9 @@ function! s:Tlist_Open_Window()
|
||||||
|
|
||||||
" Create the taglist window
|
" Create the taglist window
|
||||||
exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd
|
exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd
|
||||||
|
|
||||||
|
" Initialize the taglist window
|
||||||
|
call s:Tlist_Init_Window()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Tlist_Zoom_Window
|
" Tlist_Zoom_Window
|
||||||
|
@ -937,7 +973,7 @@ function! s:Tlist_Init_Window()
|
||||||
nnoremap <buffer> <silent> <kMultiply> :silent! %foldopen!<CR>
|
nnoremap <buffer> <silent> <kMultiply> :silent! %foldopen!<CR>
|
||||||
nnoremap <buffer> <silent> <Space> :call <SID>Tlist_Show_Tag_Prototype()<CR>
|
nnoremap <buffer> <silent> <Space> :call <SID>Tlist_Show_Tag_Prototype()<CR>
|
||||||
nnoremap <buffer> <silent> u :call <SID>Tlist_Update_Window()<CR>
|
nnoremap <buffer> <silent> u :call <SID>Tlist_Update_Window()<CR>
|
||||||
nnoremap <buffer> <silent> d :call <SID>Tlist_Remove_File(-1)<CR>
|
nnoremap <buffer> <silent> d :call <SID>Tlist_Remove_File(-1, 1)<CR>
|
||||||
nnoremap <buffer> <silent> x :call <SID>Tlist_Zoom_Window()<CR>
|
nnoremap <buffer> <silent> x :call <SID>Tlist_Zoom_Window()<CR>
|
||||||
nnoremap <buffer> <silent> [[ :call <SID>Tlist_Move_To_File(-1)<CR>
|
nnoremap <buffer> <silent> [[ :call <SID>Tlist_Move_To_File(-1)<CR>
|
||||||
nnoremap <buffer> <silent> ]] :call <SID>Tlist_Move_To_File(1)<CR>
|
nnoremap <buffer> <silent> ]] :call <SID>Tlist_Move_To_File(1)<CR>
|
||||||
|
@ -963,7 +999,7 @@ function! s:Tlist_Init_Window()
|
||||||
inoremap <buffer> <silent> <Space> <C-o>:call
|
inoremap <buffer> <silent> <Space> <C-o>:call
|
||||||
\ <SID>Tlist_Show_Tag_Prototype()<CR>
|
\ <SID>Tlist_Show_Tag_Prototype()<CR>
|
||||||
inoremap <buffer> <silent> u <C-o>:call <SID>Tlist_Update_Window()<CR>
|
inoremap <buffer> <silent> u <C-o>:call <SID>Tlist_Update_Window()<CR>
|
||||||
inoremap <buffer> <silent> d <C-o>:call <SID>Tlist_Remove_File(-1)<CR>
|
inoremap <buffer> <silent> d <C-o>:call <SID>Tlist_Remove_File(-1, 1)<CR>
|
||||||
inoremap <buffer> <silent> x <C-o>:call <SID>Tlist_Zoom_Window()<CR>
|
inoremap <buffer> <silent> x <C-o>:call <SID>Tlist_Zoom_Window()<CR>
|
||||||
inoremap <buffer> <silent> [[ <C-o>:call <SID>Tlist_Move_To_File(-1)<CR>
|
inoremap <buffer> <silent> [[ <C-o>:call <SID>Tlist_Move_To_File(-1)<CR>
|
||||||
inoremap <buffer> <silent> ]] <C-o>:call <SID>Tlist_Move_To_File(1)<CR>
|
inoremap <buffer> <silent> ]] <C-o>:call <SID>Tlist_Move_To_File(1)<CR>
|
||||||
|
@ -971,9 +1007,26 @@ function! s:Tlist_Init_Window()
|
||||||
inoremap <buffer> <silent> q <C-o>:close<CR>
|
inoremap <buffer> <silent> q <C-o>:close<CR>
|
||||||
|
|
||||||
" Map single left mouse click if the user wants this functionality
|
" Map single left mouse click if the user wants this functionality
|
||||||
if g:Tlist_Use_SingleClick
|
if g:Tlist_Use_SingleClick == 1
|
||||||
nnoremap <silent> <LeftMouse> <LeftMouse>:if bufname("%") =~ "__Tag_List__"
|
" Contributed by Bindu Wavell
|
||||||
\ <bar> call <SID>Tlist_Jump_To_Tag(0) <bar> endif <CR>
|
" attempt to perform single click mapping, it would be much
|
||||||
|
" nicer if we could nnoremap <buffer> ... however vim does
|
||||||
|
" not fire the <buffer> <leftmouse> when you use the mouse
|
||||||
|
" to enter a buffer.
|
||||||
|
let clickmap = ':if bufname("%") =~ "__Tag_List__" <bar> ' .
|
||||||
|
\ 'call <SID>Tlist_Jump_To_Tag(0) <bar> endif <CR>'
|
||||||
|
if maparg('<leftmouse>', 'n') == ''
|
||||||
|
" no mapping for leftmouse
|
||||||
|
exe ':nnoremap <silent> <leftmouse> <leftmouse>' . clickmap
|
||||||
|
else
|
||||||
|
" we have a mapping
|
||||||
|
let mapcmd = ':nnoremap <silent> <leftmouse> <leftmouse>'
|
||||||
|
let mapcmd = mapcmd . substitute(substitute(
|
||||||
|
\ maparg('<leftmouse>', 'n'), '|', '<bar>', 'g'),
|
||||||
|
\ '\c^<leftmouse>', '', '')
|
||||||
|
let mapcmd = mapcmd . clickmap
|
||||||
|
exe mapcmd
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Define the taglist autocommands
|
" Define the taglist autocommands
|
||||||
|
@ -1026,22 +1079,28 @@ function! s:Tlist_Refresh_Window()
|
||||||
" Restore the report option
|
" Restore the report option
|
||||||
let &report = old_report
|
let &report = old_report
|
||||||
|
|
||||||
" List all the tags for the previously processed files
|
if !g:Tlist_Show_One_File
|
||||||
let i = 0
|
" List all the tags for the previously processed files
|
||||||
while i < s:tlist_file_count
|
" Do this only if taglist is configured to display tags for more than
|
||||||
" Mark the file as not visible, so that Tlist_Explore_File() will
|
" one file. Otherwise, when Tlist_Show_One_File is configured,
|
||||||
" display the tags for this file and mark the file as visible
|
" tags for the wrong file will be displayed.
|
||||||
let s:tlist_{i}_visible = 0
|
let i = 0
|
||||||
call s:Tlist_Explore_File(s:tlist_{i}_filename, s:tlist_{i}_filetype)
|
while i < s:tlist_file_count
|
||||||
let i = i + 1
|
" Mark the file as not visible, so that Tlist_Explore_File() will
|
||||||
endwhile
|
" display the tags for this file and mark the file as visible
|
||||||
|
let s:tlist_{i}_visible = 0
|
||||||
|
call s:Tlist_Explore_File(s:tlist_{i}_filename,
|
||||||
|
\ s:tlist_{i}_filetype)
|
||||||
|
let i = i + 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
" If Tlist_File_Fold_Auto_Close option is set, then close all the
|
" If Tlist_File_Fold_Auto_Close option is set, then close all the
|
||||||
" folds
|
" folds
|
||||||
if g:Tlist_File_Fold_Auto_Close
|
if g:Tlist_File_Fold_Auto_Close
|
||||||
if has('folding')
|
if has('folding')
|
||||||
" Close all the folds
|
" Close all the folds
|
||||||
silent! %foldclose
|
silent! %foldclose
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1119,6 +1178,15 @@ function! s:Tlist_Explore_File(filename, ftype)
|
||||||
let file_exists = 0
|
let file_exists = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !file_exists
|
||||||
|
" Check whether this file is removed based on user request
|
||||||
|
" If it is, then don't display the tags for this file
|
||||||
|
let esc_fname = escape(a:filename, '\') . "\n"
|
||||||
|
if match(s:tlist_deleted_flist, esc_fname) != -1
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if file_exists && s:tlist_{fidx}_visible
|
if file_exists && s:tlist_{fidx}_visible
|
||||||
" Check whether the file tags are currently valid
|
" Check whether the file tags are currently valid
|
||||||
if s:tlist_{fidx}_valid
|
if s:tlist_{fidx}_valid
|
||||||
|
@ -1152,6 +1220,17 @@ function! s:Tlist_Explore_File(filename, ftype)
|
||||||
let old_report = &report
|
let old_report = &report
|
||||||
set report=99999
|
set report=99999
|
||||||
|
|
||||||
|
if g:Tlist_Show_One_File
|
||||||
|
" Remove the previous file
|
||||||
|
if s:tlist_cur_file_idx != -1
|
||||||
|
call s:Tlist_Remove_File_From_Display(s:tlist_cur_file_idx)
|
||||||
|
let s:tlist_{s:tlist_cur_file_idx}_visible = 0
|
||||||
|
let s:tlist_{s:tlist_cur_file_idx}_start = 0
|
||||||
|
let s:tlist_{s:tlist_cur_file_idx}_end = 0
|
||||||
|
endif
|
||||||
|
let s:tlist_cur_file_idx = fidx
|
||||||
|
endif
|
||||||
|
|
||||||
" Mark the buffer as modifiable
|
" Mark the buffer as modifiable
|
||||||
setlocal modifiable
|
setlocal modifiable
|
||||||
|
|
||||||
|
@ -1456,6 +1535,13 @@ function! Tlist_Update_File_Tags(filename, ftype)
|
||||||
if fidx != -1 && s:tlist_{fidx}_valid
|
if fidx != -1 && s:tlist_{fidx}_valid
|
||||||
" File exists and the tags are valid
|
" File exists and the tags are valid
|
||||||
return
|
return
|
||||||
|
else
|
||||||
|
" Check whether this file is removed based on user request
|
||||||
|
" If it is, then don't display the tags for this file
|
||||||
|
let esc_fname = escape(a:filename, '\') . "\n"
|
||||||
|
if match(s:tlist_deleted_flist, esc_fname) != -1
|
||||||
|
return
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If the taglist window is opened, update it
|
" If the taglist window is opened, update it
|
||||||
|
@ -1541,18 +1627,28 @@ function! s:Tlist_Toggle_Window()
|
||||||
" Open the taglist window
|
" Open the taglist window
|
||||||
call s:Tlist_Open_Window()
|
call s:Tlist_Open_Window()
|
||||||
|
|
||||||
" Initialize the taglist window
|
|
||||||
call s:Tlist_Init_Window()
|
|
||||||
call s:Tlist_Refresh_Window()
|
call s:Tlist_Refresh_Window()
|
||||||
|
|
||||||
" Add and list the tags for all the buffers in the bufferlist
|
if g:Tlist_Show_One_File
|
||||||
let i = 1
|
" Add only the current buffer and file
|
||||||
while i < bufnr('$')
|
"
|
||||||
let fname = fnamemodify(bufname(i), ':p')
|
" If the file doesn't support tag listing, skip it
|
||||||
let ftype = getbufvar(i, '&filetype')
|
if !s:Tlist_Skip_File(curbuf_name, curbuf_ftype)
|
||||||
call s:Tlist_Explore_File(fname, ftype)
|
call s:Tlist_Explore_File(curbuf_name, curbuf_ftype)
|
||||||
let i = i + 1
|
endif
|
||||||
endwhile
|
else
|
||||||
|
" Add and list the tags for all the buffers in the bufferlist
|
||||||
|
let i = 1
|
||||||
|
while i < bufnr('$')
|
||||||
|
let fname = fnamemodify(bufname(i), ':p')
|
||||||
|
let ftype = getbufvar(i, '&filetype')
|
||||||
|
" If the file doesn't support tag listing, skip it
|
||||||
|
if !s:Tlist_Skip_File(fname, ftype)
|
||||||
|
call s:Tlist_Explore_File(fname, ftype)
|
||||||
|
endif
|
||||||
|
let i = i + 1
|
||||||
|
endwhile
|
||||||
|
endif
|
||||||
|
|
||||||
" Highlight the current tag
|
" Highlight the current tag
|
||||||
call s:Tlist_Highlight_Tag(curbuf_name, curline, 1)
|
call s:Tlist_Highlight_Tag(curbuf_name, curline, 1)
|
||||||
|
@ -1658,16 +1754,18 @@ function! s:Tlist_Refresh()
|
||||||
let s:tlist_{fidx}_mtime = mtime
|
let s:tlist_{fidx}_mtime = mtime
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If the tag listing for the current window is already present, no
|
if s:tlist_{fidx}_visible
|
||||||
" need to refresh it
|
" If the tag listing for the current window is already present, no
|
||||||
if !g:Tlist_Auto_Highlight_Tag
|
" need to refresh it
|
||||||
|
if !g:Tlist_Auto_Highlight_Tag
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Highlight the current tag
|
||||||
|
call s:Tlist_Highlight_Tag(filename, curline, 1)
|
||||||
|
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Highlight the current tag
|
|
||||||
call s:Tlist_Highlight_Tag(filename, curline, 1)
|
|
||||||
|
|
||||||
return
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Save the current window number
|
" Save the current window number
|
||||||
|
@ -1748,6 +1846,13 @@ function! s:Tlist_Update_Tags()
|
||||||
let fidx = s:Tlist_Get_File_Index(filename)
|
let fidx = s:Tlist_Get_File_Index(filename)
|
||||||
if fidx != -1
|
if fidx != -1
|
||||||
let s:tlist_{fidx}_valid = 0
|
let s:tlist_{fidx}_valid = 0
|
||||||
|
else
|
||||||
|
" As the user requested to update the tags for the current
|
||||||
|
" file, remove it from the deleted list (if it was previously
|
||||||
|
" deleted on user request)
|
||||||
|
let esc_fname = escape(filename, '\') . "\n"
|
||||||
|
let s:tlist_deleted_flist = substitute(s:tlist_deleted_flist,
|
||||||
|
\ esc_fname, '', '')
|
||||||
endif
|
endif
|
||||||
call Tlist_Update_File_Tags(filename, &filetype)
|
call Tlist_Update_File_Tags(filename, &filetype)
|
||||||
endif
|
endif
|
||||||
|
@ -2024,7 +2129,8 @@ function! s:Tlist_Find_Tag_text(fidx, linenum)
|
||||||
" If the current line is the less than the first tag, then no need to
|
" If the current line is the less than the first tag, then no need to
|
||||||
" search
|
" search
|
||||||
let txt = s:tlist_{a:fidx}_tag_1
|
let txt = s:tlist_{a:fidx}_tag_1
|
||||||
let start = strridx(txt, 'line:') + strlen('line:')
|
" 5 == length of 'line:'
|
||||||
|
let start = strridx(txt, 'line:') + 5
|
||||||
let end = strridx(txt, "\t")
|
let end = strridx(txt, "\t")
|
||||||
if end < start
|
if end < start
|
||||||
let first_lnum = strpart(txt, start) + 0
|
let first_lnum = strpart(txt, start) + 0
|
||||||
|
@ -2040,7 +2146,8 @@ function! s:Tlist_Find_Tag_text(fidx, linenum)
|
||||||
let middle = (right + left + 1) / 2
|
let middle = (right + left + 1) / 2
|
||||||
let txt = s:tlist_{a:fidx}_tag_{middle}
|
let txt = s:tlist_{a:fidx}_tag_{middle}
|
||||||
|
|
||||||
let start = strridx(txt, 'line:') + strlen('line:')
|
" 5 == length of 'line:'
|
||||||
|
let start = strridx(txt, 'line:') + 5
|
||||||
let end = strridx(txt, "\t")
|
let end = strridx(txt, "\t")
|
||||||
if end < start
|
if end < start
|
||||||
let middle_lnum = strpart(txt, start) + 0
|
let middle_lnum = strpart(txt, start) + 0
|
||||||
|
@ -2066,7 +2173,8 @@ function! s:Tlist_Find_Tag_text(fidx, linenum)
|
||||||
while left < right
|
while left < right
|
||||||
let txt = s:tlist_{a:fidx}_tag_{left}
|
let txt = s:tlist_{a:fidx}_tag_{left}
|
||||||
|
|
||||||
let start = strridx(txt, 'line:') + strlen('line:')
|
" 5 == length of 'line:'
|
||||||
|
let start = strridx(txt, 'line:') + 5
|
||||||
let end = strridx(txt, "\t")
|
let end = strridx(txt, "\t")
|
||||||
if end < start
|
if end < start
|
||||||
let lnum = strpart(txt, start) + 0
|
let lnum = strpart(txt, start) + 0
|
||||||
|
@ -2375,7 +2483,9 @@ function! s:Tlist_Move_To_File(dir)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Otherwise, move to the beginning of the next file
|
" Otherwise, move to the beginning of the next file
|
||||||
exe s:tlist_{fidx}_start
|
if s:tlist_{fidx}_start != 0
|
||||||
|
exe s:tlist_{fidx}_start
|
||||||
|
endif
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -2402,7 +2512,7 @@ function! s:Tlist_Session_Load(...)
|
||||||
let w:tlist_file_window = "yes"
|
let w:tlist_file_window = "yes"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Open to the taglist window
|
" Open the taglist window
|
||||||
call s:Tlist_Open_Window()
|
call s:Tlist_Open_Window()
|
||||||
|
|
||||||
" Source the session file
|
" Source the session file
|
||||||
|
@ -2431,6 +2541,13 @@ function! s:Tlist_Session_Load(...)
|
||||||
let s:tlist_{fidx}_visible = 0
|
let s:tlist_{fidx}_visible = 0
|
||||||
let i = i + 1
|
let i = i + 1
|
||||||
continue
|
continue
|
||||||
|
else
|
||||||
|
" As we are loading the tags from the session file, if this
|
||||||
|
" file was previously deleted by the user, now we need to
|
||||||
|
" add it back. So remove the file from the deleted list.
|
||||||
|
let esc_fname = escape(fname, '\') . "\n"
|
||||||
|
let s:tlist_deleted_flist = substitute(s:tlist_deleted_flist,
|
||||||
|
\ esc_fname, '', '')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let fidx = s:Tlist_Init_File(fname, ftype)
|
let fidx = s:Tlist_Init_File(fname, ftype)
|
||||||
|
@ -2491,13 +2608,15 @@ function! s:Tlist_Session_Load(...)
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Initialize the taglist window
|
" Initialize the taglist window
|
||||||
call s:Tlist_Init_Window()
|
|
||||||
call s:Tlist_Refresh_Window()
|
call s:Tlist_Refresh_Window()
|
||||||
|
|
||||||
if s:tlist_file_count > 0
|
" Go back to the original window
|
||||||
" Jump to the beginning of the first file
|
let prev_Tlist_Skip_Refresh = s:Tlist_Skip_Refresh
|
||||||
call cursor(s:tlist_0_start, 1)
|
let s:Tlist_Skip_Refresh = 1
|
||||||
endif
|
wincmd p
|
||||||
|
let s:Tlist_Skip_Refresh = prev_Tlist_Skip_Refresh
|
||||||
|
|
||||||
|
call s:Tlist_Refresh()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Tlist_Session_Save
|
" Tlist_Session_Save
|
||||||
|
@ -2630,7 +2749,7 @@ function! s:Tlist_Update_File_Display(filename, action)
|
||||||
endif
|
endif
|
||||||
elseif a:action == 2
|
elseif a:action == 2
|
||||||
" Remove the file from the list
|
" Remove the file from the list
|
||||||
call s:Tlist_Remove_File(idx)
|
call s:Tlist_Remove_File(idx, 0)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Move the cursor to the original location
|
" Move the cursor to the original location
|
||||||
|
@ -2709,9 +2828,11 @@ function! TagList_Start()
|
||||||
let s:tlist_window_initialized = 1
|
let s:tlist_window_initialized = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Open the taglist window
|
" Update the taglist window
|
||||||
if bufnum != -1
|
if bufnum != -1
|
||||||
call s:Tlist_Explore_File(filename, ftype)
|
if !s:Tlist_Skip_File(filename, ftype)
|
||||||
|
call s:Tlist_Explore_File(filename, ftype)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue