6
4
I often have several files open in vim, each in a different tab. I have to remember which tab has which file open. Is there a way to show this in the tab titles?
6
4
I often have several files open in vim, each in a different tab. I have to remember which tab has which file open. Is there a way to show this in the tab titles?
4
From vim.wikia.com:
Add this to your .vimrc:
let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]"
if &term == "screen"
set t_ts=^[k
set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
set title
endif
:set title
is enough for terminator
too - I added this to the .vimrc – Vitaly Zdanevich – 2016-03-07T08:24:11.837
4:set title
is enough for gnome-terminal
. – Benjamin Bannier – 2010-07-03T23:25:14.757
1For anyone curious: To make the title just the filename, change the first line to let &titlestring = expand("%:t")
. – Matthew – 2010-07-04T23:45:22.380
0
More simple way for gnome-terminal, write below in your vimrc :
set title
autocmd BufRead * let &titlestring = expand("%:p")
show only filepath in title
vim
supports tabs (both in the GUI and on the command line), so you do not need to use tabs fromgnome-terminal
. See:help tabpage
. – Benjamin Bannier – 2010-07-03T23:26:48.793@honk: Thanks, that's pretty neat! I think I'm going to stick with
gnome-terminal
tabs, so that I can usealt + [tab number]
to switch between them. Or is there a way to do this invim
, too? – Matthew – 2010-07-04T01:00:07.307CTRL-PgUp/gt and CTRL-PgDown/gT for switching to next/previous tab, and also e.g. 2gt to go to tab 2. Not sure if the CTRL part is default or depends on the terminal setup. – Benjamin Bannier – 2010-07-04T02:12:41.273
@honk:
gnome-terminal
stealsCTRL-PgUp/PgDown
when multiple terminal tabs are open (it works whenvim
is the only one).2gt
works, but neither option is as convenient forant + [tab number]
anyway. Thanks for the tip, though, I'll remember it if I'm ever stuck using a terminal without tabs. – Matthew – 2010-07-04T18:31:56.080