mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 11:30:28 +01:00
Add key to show tag in preview window
This commit is contained in:
@@ -922,11 +922,12 @@ function! s:MapKeys() abort
|
||||
\ <LeftRelease><C-o>:call <SID>CheckMouseClick()<CR>
|
||||
|
||||
let maps = [
|
||||
\ ['jump', 'JumpToTag(0)'],
|
||||
\ ['preview', 'JumpToTag(1)'],
|
||||
\ ['nexttag', 'GotoNextToplevelTag(1)'],
|
||||
\ ['prevtag', 'GotoNextToplevelTag(-1)'],
|
||||
\ ['showproto', 'ShowPrototype(0)'],
|
||||
\ ['jump', 'JumpToTag(0)'],
|
||||
\ ['preview', 'JumpToTag(1)'],
|
||||
\ ['previewwin', 'ShowInPreviewWin()'],
|
||||
\ ['nexttag', 'GotoNextToplevelTag(1)'],
|
||||
\ ['prevtag', 'GotoNextToplevelTag(-1)'],
|
||||
\ ['showproto', 'ShowPrototype(0)'],
|
||||
\
|
||||
\ ['openfold', 'OpenFold()'],
|
||||
\ ['closefold', 'CloseFold()'],
|
||||
@@ -2797,6 +2798,7 @@ function! s:PrintHelp() abort
|
||||
silent put ='\" ' . s:get_map_str('jump') . ': Jump to tag definition'
|
||||
silent put ='\" ' . s:get_map_str('preview') . ': As above, but stay in'
|
||||
silent put ='\" Tagbar window'
|
||||
silent put ='\" ' . s:get_map_str('previewwin') . ': Show tag in preview window'
|
||||
silent put ='\" ' . s:get_map_str('nexttag') . ': Go to next top-level tag'
|
||||
silent put ='\" ' . s:get_map_str('prevtag') . ': Go to previous top-level tag'
|
||||
silent put ='\" ' . s:get_map_str('showproto') . ': Display tag prototype'
|
||||
@@ -2996,6 +2998,18 @@ function! s:JumpToTag(stay_in_tagbar) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" s:ShowInPreviewWin() {{{2
|
||||
function! s:ShowInPreviewWin() abort
|
||||
let taginfo = s:GetTagInfo(line('.'), 1)
|
||||
|
||||
if empty(taginfo) || !taginfo.isNormalTag()
|
||||
return
|
||||
endif
|
||||
|
||||
execute 'topleft pedit +' . taginfo.fields.line . ' ' .
|
||||
\ s:known_files.getCurrent(0).fpath
|
||||
endfunction
|
||||
|
||||
" s:ShowPrototype() {{{2
|
||||
function! s:ShowPrototype(short) abort
|
||||
let taginfo = s:GetTagInfo(line('.'), 1)
|
||||
|
||||
@@ -318,6 +318,8 @@ The following mappings are valid in the Tagbar window:
|
||||
Map option: tagbar_map_jump
|
||||
p Jump to the tag under the cursor, but stay in the Tagbar window.
|
||||
Map option: tagbar_map_preview
|
||||
P Open the tag in a |preview-window|.
|
||||
Map option: tagbar_map_previewwin
|
||||
<LeftMouse> When on a fold icon, open or close the fold depending on the
|
||||
current state.
|
||||
<2-LeftMouse> Same as <CR>. See |g:tagbar_singleclick| if you want to use a
|
||||
|
||||
@@ -80,11 +80,12 @@ if !exists('g:tagbar_iconchars')
|
||||
endif
|
||||
|
||||
let s:keymaps = [
|
||||
\ ['jump', '<CR>'],
|
||||
\ ['preview', 'p'],
|
||||
\ ['nexttag', '<C-N>'],
|
||||
\ ['prevtag', '<C-P>'],
|
||||
\ ['showproto', '<Space>'],
|
||||
\ ['jump', '<CR>'],
|
||||
\ ['preview', 'p'],
|
||||
\ ['previewwin', 'P'],
|
||||
\ ['nexttag', '<C-N>'],
|
||||
\ ['prevtag', '<C-P>'],
|
||||
\ ['showproto', '<Space>'],
|
||||
\
|
||||
\ ['openfold', ['+', '<kPlus>', 'zo']],
|
||||
\ ['closefold', ['-', '<kMinus>', 'zc']],
|
||||
|
||||
Reference in New Issue
Block a user