diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 4d5a1f1..08476fe 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -303,6 +303,7 @@ function! s:MapKeys() abort \ ['togglesort', 'ToggleSort()'], \ ['togglecaseinsensitive', 'ToggleCaseInsensitive()'], \ ['toggleautoclose', 'ToggleAutoclose()'], + \ ['togglepause', 'TogglePause()'], \ ['zoomwin', 'ZoomWindow()'], \ ['close', 'CloseWindow()'], \ ['help', 'ToggleHelp()'], @@ -1832,6 +1833,7 @@ function! s:PrintHelp() abort silent put ='\" ' . s:get_map_str('togglesort') . ': Toggle sort' silent put ='\" ' . s:get_map_str('togglecaseinsensitive') . ': Toggle case insensitive sort option' silent put ='\" ' . s:get_map_str('toggleautoclose') . ': Toggle autoclose option' + silent put ='\" ' . s:get_map_str('togglepause') . ': Toggle pause' silent put ='\" ' . s:get_map_str('zoomwin') . ': Zoom window in/out' silent put ='\" ' . s:get_map_str('close') . ': Close window' silent put ='\" ' . s:get_map_str('help') . ': Toggle help' @@ -3188,6 +3190,21 @@ function! s:warning(msg) abort echohl None endfunction +" s:TogglePause() {{{2 +function! s:TogglePause() abort + let s:paused = !s:paused + + if s:paused + call tagbar#state#set_paused() + else + let fileinfo = tagbar#state#get_current_file(0) + let taginfo = fileinfo.getTags()[0] + + call s:GotoFileWindow(taginfo.fileinfo) + call s:AutoUpdate(taginfo.fileinfo.fpath, 1) + endif +endfunction + " TagbarBalloonExpr() {{{2 function! TagbarBalloonExpr() abort let taginfo = s:GetTagInfo(v:beval_lnum, 1) diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 0efcf37..697c7b1 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -360,6 +360,8 @@ s Toggle sort order between name and file order. Map option: tagbar_map_togglesort c Toggle the |g:tagbar_autoclose| option. Map option: tagbar_map_toggleautoclose +t Toggle the pause (like :TagbarTogglePause) + Map option: tagbar_map_togglepause x Toggle zooming the window. Map option: tagbar_map_zoomwin q Close the Tagbar window. diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 9eee0d0..7634eba 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -116,6 +116,7 @@ function! s:setup_keymaps() abort \ ['togglesort', 's'], \ ['togglecaseinsensitive', 'i'], \ ['toggleautoclose', 'c'], + \ ['togglepause', 't'], \ ['zoomwin', 'x'], \ ['close', 'q'], \ ['help', ['', '?']],