Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Monday, December 29, 2008

Just Keep Vimming In Tabs

Lately, I've been using vim more frequently. Here are a few useful tricks that I've picked up.

So the feature for viewing multiple files in tabs has been around for a while, but I only just discovered it. You can open up multiple files in tabs with

vim -p file1 file2 .. fileN

You can go to the next or previous tab with :tabn or :tabp. And you can edit a new tab with :tabe file_name. Close all but the current tab with :tabo. Annoyingly, I haven't found a single command that just quits and closes all the tabs, but :tabo followed by :q will get you there.

Also, since I use a black background for my terminal, the default font color for the selected tab name wasn't visible. You can change this color with the following command:

hi TabLineSel ctermfg=white

Also I wanted to remap the gt command used to toggle between commands to the Ctrl-T keystroke which is closer to what I use for tabs in Firefox. This can be accomplished through

map ^T gt

but it is tricky typing in Ctrl-T because it's mapped to something else. You need to type Ctrl-V first (right before typing Ctrl-T) to make this work.

You can put all these commands in your .vimrc file so that they get loaded every time you edit a file.

--Arkajit