Search This Blog

Saturday, 1 September 2012

Vi editor


VI EDITER COMMANDS

Vi editer:
        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:
1)
2)  w(mw) ::next word starting
     e(ne)::word ending
     b(nb)::word beginning
3) $ ::places cussor at end of the current line.
    ^ :: places cussor at begining of the current line.
4) # :: places cussor at begining of the page.
5) M :: places cussor at middle of the page.
6) L :: places cussor at end of the page.
7) ctrl f ::forward one page(pg dn key).
    ctrl b ::backword one page(pg up key).
8) x(nx) ::To delete current(del key).
9) X ::It delets previous char(back space).
10) dw(adw)::to delete a word.
11) dd(ndd)::to delete a line.
12)d$ ::It deletes current position of the line.
13)d$ ::It deletes current begining of the line.
14) yw(nyw) :: to copy the word.
15) yy(xyy) :: to copy a line.
16) y$ :: It copies current position to end of the line.
17) y^ :: It copies current position to beginning of the line.
18) P :: paste
19) U ::undo
20) CC :: to clear a line
21) J :: to join a line
22) ZZ :: Save&Quit


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











No comments: