Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have installed tags so I can jump to a function body in another file via CTRL + ]
I know that I can do gf to jump to another file.
I know that I can do CTRL-w s to split the vim window.
What I don't know and I am very interested in, is how can I combine the first 2 with the last.
I.e. how could I jump to another file via tag or gf opening the file in a separate tab?

share|improve this question
    
possible cross site duplicate of: stackoverflow.com/questions/908269/… –  Ciro Santilli Sep 15 at 15:05

1 Answer 1

up vote 3 down vote accepted

You can split and open a new file at the named tag with the command :stag, it appears to default to the binding Ctrl-w, Ctrl-].

You could bind that to whatever then:

map <F2> :stag

If needs to be done in a tab, then, you can do it in two steps:

Ctrl-w,Ctrl-] Ctrl-w, T

Or you can map it:

map <F2> :tab split <CR>:exec("tag ".expand("<cword>"))<CR>

For the gf equivalent of opening in new tab

Ctrl-w,gf

or window split:

Ctrl-w,f

And again if you want to split AND then open in new tab,

Ctrl-w,f Ctrl-w, T

share|improve this answer
    
Yeap. This works for ctags +1. How about gf? –  Jim Aug 13 '13 at 21:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.