Allow single-click for jumping to a tag, closes #16

This commit is contained in:
Jan Larres 2011-06-06 18:42:35 +12:00
parent 9d5af93a5b
commit 7aa936dc9c
2 changed files with 20 additions and 1 deletions

View File

@ -262,7 +262,8 @@ These mappings are valid in the Tagbar window:
p Jump to the tag under the cursor, but stay in the Tagbar window.
<LeftMouse> When on a fold icon, open or close the fold depending on the
current state.
<2-LeftMouse> Same as <CR>.
<2-LeftMouse> Same as <CR>. See |g:tagbar_singleclick| if you want to use a
single- instead of a double-click.
<Space> Display the prototype of the current tag (i.e. the line defining
it) in the command line.
+/zo Open the fold under the cursor.
@ -379,6 +380,18 @@ Example:
let g:tagbar_expand = 1
<
*g:tagbar_singleclick*
g:tagbar_singleclick~
Default: 0
If this option is set then a single- instead of a double-click is used to jump
to the tag definition.
Example:
>
let g:tagbar_singleclick = 1
<
*g:tagbar_foldlevel*
g:tagbar_foldlevel~
Default: 99

View File

@ -97,6 +97,10 @@ if !exists('g:tagbar_expand')
let g:tagbar_expand = 0
endif
if !exists('g:tagbar_singleclick')
let g:tagbar_singleclick = 0
endif
if !exists('g:tagbar_foldlevel')
let g:tagbar_foldlevel = 99
endif
@ -2788,6 +2792,8 @@ function! s:CheckMouseClick()
call s:CloseFold()
elseif (match(line, s:icon_closed . '[-+ ]') + 1) == curcol
call s:OpenFold()
elseif g:tagbar_singleclick
call s:JumpToTag(0)
endif
endfunction