Reputation: 1900
How can I switch to the tab where I'm working on a particular file, when I know its filename, but not its tab number?
Suppose I have lots of open tabs in Vim, say 20, and I need to move to the particular tab where I'm working on file foo
. The thing is, I don't know the tab number. So {number}gt
will not do. And I'm lazy to have to switch among 19 tabs until I find it.
I'm looking for something like gt foo
Upvotes: 0
Views: 60
Reputation: 196476
With this option:
set switchbuf=useopen,usetab
in your ~/.vimrc
you can do :sb foo
to go to buffer foo
wherever it is displayed.
See :help :sb
and :help switchbuf
.
However…
Vim's tab pages are not at all like tabs in other editors: you can't have a 1:1 relationship between a tab page and a file/buffer or even between a window and a file/buffer. Tab pages are more like ad-hoc workspaces and windows are viewports.
Buffers are Vim's real file proxies (and more) so, my advice is to drop tab pages and use straight buffers instead.
Upvotes: 2