Search code examples
vimctags

vim tags: how to get <C-w><C-]> behave with tselect


With the help of this: https://stackoverflow.com/a/42078499/629530

I've added this in my ~/.vimrc:

nnoremap <C-]> g<C-]>

That works well: <C-]> now shows the tselect output and I can choose the option I desire. But I also like to use <C-w><C-]> to open the tag result in a new split vim window. But that behaves with the old tag (<C-]>) behavior. I want that to show the tselect output as well. I tried this:

nnoremap <C-w><C-]> g<C-w><C-]>

and this:

nnoremap <C-w><C-]> <C-w>g<C-]>

But neither of those work like I want.

The fact is: is there a way to make :tag, <C-]>, etc. all behave by default with the tselect behavior? I would prefer that.

Thanks,


Solution

  • From the documentation, the Ctrl-wg] combination is what splits, then uses the under-cursor word as the tag to :tselect on. So your .vimrc should have:

    nnoremap <C-w><C-]> <C-w>g]