Spiga

Basic Linux VI Command

Basic Linux VI Command


Moving the Cursor

*j or
[or down-arrow]
move cursor down one line
*k [or up-arrow]move cursor up one line
*h or
[or left-arrow]
move cursor left one character
*l or
[or right-arrow]
move cursor right one character
*0 (zero)move cursor to start of current line (the one with the cursor)
*$move cursor to end of current line
wmove cursor to beginning of next word
bmove cursor back to beginning of preceding word
:0 or 1Gmove cursor to first line in file
:n or nGmove cursor to line n
:$ or Gmove cursor to last line in file

Adding, Changing, and Deleting Text

*u UNDO WHATEVER YOU JUST DID;
*iinsert text before cursor, until hit
Iinsert text at beginning of current line, until hit
*aappend text after cursor, until hit
Aappend text to end of current line, until hit
*oopen and put text in a new line below current line, until hit
*Oopen and put text in a new line above current line, until hit
*rreplace single character under cursor (no needed)
Rreplace characters, starting with current cursor position, until hit
cwchange the current word with new text,
starting with the character under cursor, until hit
cNwchange N words beginning with character under cursor, until hit;
e.g., c5w changes 5 words
Cchange (replace) the characters in the current line, until hit
ccchange (replace) the entire current line, stopping when is hit
Ncc or cNcchange (replace) the next N lines, starting with the current line,
stopping when is hit
*xdelete single character under cursor
Nxdelete N characters, starting with character under cursor
dwdelete the single word beginning with character under cursor
dNwdelete N words beginning with character under cursor;
e.g., d5w deletes 5 words
Ddelete the remainder of the line, starting with current cursor position
*dddelete entire current line
Ndd or dNddelete N lines, beginning with the current line;
e.g., 5dd deletes 5 lines
yycopy (yank, cut) the current line into the buffer
Nyy or yNycopy (yank, cut) the next N lines, including the current line, into the buffer
pput (paste) the line(s) in the buffer into the text after the current line

0 comments: