Friday 26 February 2016

VI EDITOR COMMANDS

Vi editor is used to create new files. (or) To modify already existing files.

It is classified into 3 models

1)command mode.
2)Input (or) Insert mode.
3)Ex command mode.

The default mode is command mode.
How to shift command mode to Insert mode:
1)A :: It places at end of the current line.
2)a :: It places at right of the cussor position.
3)I :: It places at begining of the cussor line.
4)i :: It places at left of the cussor position.
5)O ::Insert new line above this the cussor position.
6)o :: Insert new line bellow this the cussor position.
7)esc ::Is the key to shift from insert mode to command mode.
8): ::Is the command to shift from command mode to  Ex command mode.
Command mode commands:
w(mw) ::next word starting
e(ne)::word ending
b(nb)::word beginning
$ ::places cussor at end of the current line.
^ :: places cussor at begining of the current line.
# :: places cussor at begining of the page.
M :: places cussor at middle of the page.
L :: places cussor at end of the page.
ctrl f ::forward one page(pg dn key).
ctrl b ::backword one page(pg up key).
x(nx) ::To delete current(del key).
X ::It delets previous char(back space).
dw(adw)::to delete a word.
dd(ndd)::to delete a line.
d$ ::It deletes current position of the line.
d$ ::It deletes current begining of the line.
yw(nyw) :: to copy the word.
yy(xyy) :: to copy a line.
y$ :: It copies current position to end of the line.
y^ :: It copies current position to beginning of the line.
P :: paste
U ::undo
CC :: to clear a line
J :: to join a line
ZZ :: Save&Quit

Ex commands mode commands:
:w :: save & without quit
:w file name ::save with given file.
:q! ::Quit with out sae
:wq ::save & quit
:1 ::it places cussor at first line of the file.
:$ ::it places cussor at last line of the file.
:setnu ::set line number.
:setnonu ::remove line no.
:!<unix comm.> ::it exutes unix command.
:|string| ::Top to bottom.
:|string? :: bottom to top.
:start line,end line ::s|old string|new string|gi (search & replace).

No comments:

Post a Comment