简体   繁体   中英

have vim tag-matchlist open a new tab

I've got things configured so CTRL-] on a tag goes directly to the file in a new tab if there is only one match. If there are multiple matches, tag-matchlist appears in a new pane in the present tab. Hitting the number and enter then opens the entry in a split pane.

How can I adjust things, please, so that either:

a) the tab-matchlist opens in a new tab

or

b) the chosen entry will appear in a new tab

You can use the following mapping to show the matchlist for the tag under your cursor in the current window and open the chosen tag in a tab:

nnoremap <F6> :tab tselect <C-r><C-w><CR>

It is an alternative version of your mapping but a little less messy.

The following mapping yanks the tag under your cursor to register t , opens a new tab and does :tselect with register t (and thus shows the matchlist in that tab):

nnoremap <F7> "tyiw:tabnew<CR>:tselect <C-r>t<CR>

Figured out how to do exactly what I want:

nnoremap <C-]> :tab tjump <Cr><Cw><CR>

If there's one match, that jumps directly to the tag in a new tab.

If there are multiple matches, that opens the tag-matchlist, then once the desired entry is selected, it jumps to that tag in a new tab.

Many thanks to @romainl for pointing me in the right direction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM