mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 19:40:27 +01:00
Keep cursor on current tag when sorting, closes #200
This commit is contained in:
@@ -2527,7 +2527,9 @@ function! s:ToggleSort() abort
|
||||
return
|
||||
endif
|
||||
|
||||
" Save the tag the cursor is currently on
|
||||
let curline = line('.')
|
||||
let taginfo = s:GetTagInfo(curline, 0)
|
||||
|
||||
match none
|
||||
|
||||
@@ -2544,7 +2546,13 @@ function! s:ToggleSort() abort
|
||||
call s:RenderContent()
|
||||
call s:SetStatusLine('current')
|
||||
|
||||
execute curline
|
||||
" If we were on a tag before sorting then jump to it, otherwise restore
|
||||
" the cursor to the current line
|
||||
if !empty(taginfo)
|
||||
execute taginfo.tline
|
||||
else
|
||||
execute curline
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Display {{{1
|
||||
|
||||
Reference in New Issue
Block a user