ifacethoughts

Open vim With One Tab Per File

Since I advocate vim to a lot of freshers and beginners, I get a lot of questions on using it. A friend asked me how to start gvim with multiple files so that they are opened in separate tabs, which have been a highlight since the 7.0 release. A very common requirement, since most of the other editors use it as the default.

However, vim has traditionally been a console editor. The way it supports editing multiple files is through buffers, and buffers are not same as tabs. So, by default vim, and hence gvim, does not open multiple tabs when you start it with multiple files. However, being one of the most extensive tools you will ever use, it provides a way of doing this. The following command should do this for you:

gvim -p .vimrc .gvimrc

This also works with vim which works in the console. You can create an alias on your Unix system if you want this as the default behavior. I can have the following alias in my .bashrc

alias gvim='gvim -p'

If you are on the Windows, where it is a sin to use the command line, you can configure the Send To options to add a shortcut with the following command.

"C:\vim\vim70\gvim.exe" -p "%*"

There are many more customizations that you can do to make vim behave as you want. All you need to do is just explore.

Say your thought!

Who are you?

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
Y!: anadgouda
GTalk: anadgouda@gmail.com
MSN: anadgouda@hotmail.com
Skype: anadgouda
My bookmarks

currentproject

Complete Wellbeing

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.

Twitter - Using Envy Code R and liking it. Thank you Damien. http://tinyurl.com/688mft