Sunday, May 1, 2011

VI Basic Commands



vi invokes vi editor mode
write and quit
write file
:w filename
write to another file
overwrite existing file
quite without writing
quit file (discarding edits)
a append after cursor
A append text to end of current line
c0 change to the beginning of line
cc change the entire line
cw change to the end of a word
C or c$ change to end of line
dd delete line
dw delete word
D deletes from the cursor position to the end of the line
esc terminate insert mode
h left, one space
H top line of screen
i insert text at current cursor position
I insert text at beginning of line
j down, one line
k up, one line
l right, one space
L last line of screen
n repeat previous search
N repeat search in opposite direction
o open line below current line
O open line above current line
p puts the text that is in the buffer after the cursor position
r replace one character
s substitute
S substitute entire line
u undo last change
w move to the next word
x delete character under cursor
y yank - copy text into the buffer
Ctrl/B Scroll backward one screen
Ctrl/F Scroll forward one screen
Ctrl/G display current line number
/text search for text
/ repeat forward search
backspace move back one character
return move down one line
. (period) repeat last command
~ (tilde) change the case of a letter
^ or 0 (zero) move to beginning of line
$ (dollar) move to end of line

No comments: