And the VIM developers agree. Although VIM calls them "tab-pages", the functionality is there, waiting to be used. Before reading any further, ensure that your VIM supports tabs. You can do this by running this command, on anything resembling Unix: vim --version | fgrep '+windows', which will check for the required windows feature. If you don't see any output, check your vendor's packaging system for something like 'vim-full'. If you don't have a VIM available with the windows feature, go get one and come back. Now that you can use tabs, let's get started. One way to open tabs is via the command line. vim uses the -p option to determine how many tab-pages to open. This functions like the -[oO] options for windows in that it accepts a numeric argument, but defaults to one for each specified file. Thus, let's propose a hypothetical situation. I want to compare the implementation of has() in both Moose and Mouse. Therefore, it might be convenient to have the two files open in two tab-pages in VIM. Presuming I'm in the same directory as both files, I would open vim with a tab-page for each file like so: vim -p Moose.pm Mouse.pm. Enough talk. How about some pretty pictures?
Notice the bar at the top of the terminal? That's the tab bar. It has every open tab, plus an X at the far right. That's great, and all, but how does one use this? There are a number of ways, depending upon your configuration. First, there's the basic tab page commands. These are:
- gt Advance to the next rightmost tab, cycling back to the first.
- gT Advance to the next leftmost tab, cycling back to the last.
- {count}gt Go to the {count} tab.

2 comments:
This is great! Thanks!
Hi, I have created a blog entry explaining the tab feature in vim and how to use it. Check it out.. http://blog.sriunplugged.com/vi/tab-feature-in-vim/
Post a Comment