mirror of
https://github.com/preservim/tagbar.git
synced 2025-02-12 23:58:48 +08:00
Try to jump to the right tag column, closes #326
This commit is contained in:
parent
d379913b9a
commit
2955f71856
|
@ -1261,7 +1261,7 @@ function! s:BaseTag._init(name) abort dict
|
|||
let self.name = a:name
|
||||
let self.fields = {}
|
||||
let self.fields.line = 0
|
||||
let self.fields.column = 1
|
||||
let self.fields.column = 0
|
||||
let self.prototype = ''
|
||||
let self.path = ''
|
||||
let self.fullpath = a:name
|
||||
|
@ -3098,9 +3098,15 @@ function! s:JumpToTag(stay_in_tagbar) abort
|
|||
let taginfo.fileinfo.fline[curline] = taginfo
|
||||
endif
|
||||
|
||||
" Center the tag in the window and jump to the correct column if available
|
||||
" Center the tag in the window and jump to the correct column if
|
||||
" available, otherwise try to find it in the line
|
||||
normal! z.
|
||||
call cursor(taginfo.fields.line, taginfo.fields.column)
|
||||
if taginfo.fields.column > 0
|
||||
call cursor(taginfo.fields.line, taginfo.fields.column)
|
||||
else
|
||||
call cursor(taginfo.fields.line, 1)
|
||||
call search(taginfo.name, 'c', line('.'))
|
||||
endif
|
||||
|
||||
normal! zv
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user