Tab Feature in Vim


Vim is one of the simplest looking but most powerful editor I have seen. So thought of listing a few interesting one that I came across.
Tab Opening of Files.
Vi tab screenshot
There are two methods of starting files in tabs.

  1. By opening vi the files you want to open: This is done by using the command
     vi -p <file 1> <file 2> ...<file n>
  2. By opening a file inside vi : This is done by going to command mode in vi and using the command
     :tabnew <filename>

    . The file name here is not essential. If not provided it opens a blank tab where you can open any file needed.

You can switch between tabs using the command

:tabn {count} - Next Tab

and

 :tabp {count} -Previous Tab 

where count can specify how many tabs to switch.
Closing of a Tab can be done by the command

:tabc

There are much more commands in tab which does some specific tasks. So try these out and if necessary check out the vim manual.


, , , , ,

  1. #1 by Nikhil Singh on January 25, 2010 - 10:46 am

    I have made a few settings in my vimrc that allows me to easily change between tabs.

    ” Ctrl + F11 to go to the previous tab
    imap :tabprev
    map :tabprev

    ” Ctrl + F12 to go to the next tab
    imap :tabnext
    map :tabnext

    Let me know if it’s helpful

(will not be published)


  1. Webmaster