Showing posts with label Vim Editor. Show all posts
Showing posts with label Vim Editor. Show all posts

Saturday, June 11, 2011

Understanding VIM : [Tabs] Tutorial-5

It's quite possible that you may be working on several projects at once, having tabs set up can be a cool way to multi-task without having to see all of your files at once.
If you want to start Vim with more than one file, run vim -p filename1 filename2. This will open each file in its own tab.
Already in a Vim session? You can open a new tab with :tabnew filename to open (or create) a file.
To switch to the next (right) tab use gt in command mode. To switch to the previous (left) tab, use gT.
To close a tab you can use :q. If you're editing one file in a tab and use :wq Or you can use :tabc to save & close it.

Sunday, June 5, 2011

Understanding VIM : [Viewpoints] Tutorial-4

Using viewpoints & tabs (introduced in vim 7), we can edit more than one file at a time. This is useful when you are connected with a remote machine & you prefer to open only one session. It's also useful when we want to edit a long file at different lines.
Viewpoints breaks the vim editor into two or more segments, either vertically or horizontally. Open a vi editor & then go to last line command, enter :split. You can now see two views of the same file.

Sunday, April 10, 2011

Understanding VIM : Beginner's Tutorial-3

In the previous tut.,  we have learned copying/pasting/searching within the file. Now, we are going to take a step further in the direction of Vim editor mastery.
While editing a file, we may need to number the lines with in the file, most probably in case of a program, may be a C program. We can achieve this by this command. (Note that we are in last line mode.)
:set number 
or its abbreviation:
:set nu 

Tuesday, January 4, 2011

Understanding VIM : Beginner's Tutorial-2

Cont. from previous post.
Here we are going to know about copying/pasting & searching in vim editor. Let's open a file, created previously.
Now, we want to search 'gofer'. If you are not inside command mode, type [esc]. Now, type /gofer & enter. If you want to highlight next appearance of gofer, hit n. If you want to highlight previous appearance of gofer, hit N.

Friday, December 31, 2010

Understanding VIM : Beginner's Tutorial-1

Vim editor takes some time to settle within the working arena  of professionals. It's a cake walk when people use it for atleast a week.
There are three modes in vim - insert mode, command mode, and last-line mode.
Insert mode is meant for inserting text, press i for start mode. Command mode is used for executing formating texts. Last-line mode is used for executing extended commands for text formating.
Start Vim by typing vim /vi .