Assume:
You know how to use Vim,
You want to continue to use Vim,
You have a streak of nerd in you!
OK, in Vim, there is a typical way to split windows but want I want to talk about today is how to show multiple files as if they are tabbed windows. Granted, its not FireFox but it works very well and will save you a lot of trouble.
(Of course the problem with Vim is that nothing is every easy)
First, let's launch vim preferably with a file.
---------------------------------------------------------------------------------------------------------------------------------
vim (name of file)
---------------------------------------------------------------------------------------------------------------------------------
Now once in Vim we now need file number 2. The problem is if we just load it, we delete file number 1. Not good!
Instead we type this into our Vim editor.
---------------------------------------------------------------------------------------------------------------------------------
:tabnew (name of file)
---------------------------------------------------------------------------------------------------------------------------------
Now you should see two tabs on the screen. Yes!
There are a few ways to get to the file in question but my favorite is this:
---------------------------------------------------------------------------------------------------------------------------------
tabn 1 (name of file)
---------------------------------------------------------------------------------------------------------------------------------
In this example it will go to tab 1.
---------------------------------------------------------------------------------------------------------------------------------
tabn 4
---------------------------------------------------------------------------------------------------------------------------------
This will go to document 4.
To close a tab, its the standard:
---------------------------------------------------------------------------------------------------------------------------------
:q
---------------------------------------------------------------------------------------------------------------------------------
(or :wq) if you need to write the file to disk.
That's it.
To be complete:
:tablast
:tabfirst
:tabprior
:tabnext
Again all you're doing is tab + (first,last,next,prior)
Enjoy your tabs!
No comments:
Post a Comment