vim Editor PART-1 !


Vim (a contraction of Vi IMproved) is a text editor written by Bram Moolenaar.It can be used both in GUI and in console mode.Vim is free and open source software. Vim has been ported to many operating systems including AmigaOS (the initial target platform), Atari MiNT, BeOS, DOS, Microsoft Windows 95/98/Me/NT/2000/XP/Server 2003/Vista/Server 2008/7/8, IBM OS/2 and OS/390, MorphOS, OpenVMS, QNX, RISC OS, Unix, Linux, BSD, and Mac OS.
INSTALLATION Of Vim on LINUX :
This is done by command :
sudo apt-get install vim
Vim editor works in following modes :-
1) Normal Mode : This is the mode in which you enter editor.
2) Visual Mode : ctrl +v v This is like Normal mode, but the movement commands extend a highlighted area. When a non-movement command is used, it is executed for the highlighted area. See |Visual-mode|.If the 'showmode' option is on "-- VISUAL --" is shown at the bottom of the window.
3) Select mode : from visual mode press ctrl+G
4)Command mode: press esc from Insert mode.
COMMANDS :

1) To move the cursor, press the h,j,k,l keys as indicated.
^
k Hint: The h key is at the left and moves left.
< h l > The l key is at the right and moves right.
j The j key looks like a down arrow.
v The k key looks like a up arrow


Opening or Creating a File in Vim :
vim abc.txt
or vim abc

By the above command,file is either opened(if exists) or is created(if does not exists).
By default file in vim opens in Command mode.If you want to shift to Insert mode,then press i.
2) You can use key A to append text
3) Press the x key to delete the unwanted character.
4) Use :wq to save a file and exit.
5) dw is used to delete a word.
6) d$ is used to delete to the end of the line.
7) MOTIONS around the text :
w - until the start of the next word, EXCLUDING its first character.
e - to the end of the current word, INCLUDING the last character.
$ - to the end of the line, INCLUDING the last character.
8)USING A COUNT FOR A MOTION :
Type 2w to move the cursor two words forward.
Type 3e to move the cursor to the end of the third word forward.
Type 0 (zero) to move to the start of the line.
9) Type d2w to delete the two UPPER CASE words
10) Type dd to delete a whole line.
11) Type u to undo the last command executed.
12) To undo all the changes on a line, type: U (capital U)
13) To undo the undo's, type:CTRL-R
14) Type p to put previously deleted text after the cursor
15) Type rx to replace the character at the cursor with x
a. Move the cursor to the first line below marked --->.
b. Move the cursor so that it is on top of the first error.
c. Type r and then the character which should be there.
16) Press G to move you to the bottom of the file.
Type gg to move you to the start of the file.
17) To go back to where you came from press CTRL-O
18) THE SEARCH COMMAND :
For character :
1. In Normal mode type the / character. Notice that it and the cursor
appear at the bottom of the screen as with the : command.
2. Now type 'ska' . This is the word you want to search for.
For special Characters like () or {} or [] :
type % sign and these will be marked.



to be continued.....

No comments:

Post a Comment

SAY HELLO!!