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?
2 Answers
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
-
5
-
1For anyone curious: To make the title just the filename, change the first line to
let &titlestring = expand("%:t")
.– MatthewJul 4, 2010 at 23:45 -
:set title
is enough forterminator
too - I added this to the .vimrc Mar 7, 2016 at 8:24
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
.gnome-terminal
tabs, so that I can usealt + [tab number]
to switch between them. Or is there a way to do this invim
, too?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.