Sometimes, it's easiest to cheat
When it comes to learning Vi, anyway. . .
When I was trying to get my head round it, I went through vimtutor and made notes of the interesting & useful commands. The most useful ones, I saved. And here they are, for whoever wants them:
(The formatting doesn't preserve wonderfully, I'm afraid)
I hope that helps any prospective Vi users. If not, run through vimtutor and make your own :P
When I was trying to get my head round it, I went through vimtutor and made notes of the interesting & useful commands. The most useful ones, I saved. And here they are, for whoever wants them:
(The formatting doesn't preserve wonderfully, I'm afraid)
===============================================================================
VIM cheat sheet
===============================================================================
h, j, k, l - left, down, up, right
) - Beginning of next sentence
( - Beginning of current sentence
$ - end of line
^ - start of line
CTRL-E - Scroll down a line
CTRL-Y - Scroll up a line
CTRL-F - Page down
CTRL-B - Page up
CTRL-D - 1/2 page down
CTRL-U - 1/2 page up
CTRL-G - Show position
n Shift-G - Move to line n
/text - Search for text
n - Search for next instance of text
:set ic - ignore case
:set noic - stop ignoring case
% - Find matching ) > ] etc
:s/old/new - Change the next occurence of old to new
:%s/old/new/g - Replace all old with new
:n,ns/old/new/g - Replace all old with new from lines n to n
u - undo last commands
U - undo whole line
CTRL-R - undo the undo
r - replace current character
R - Overwrite text
x - delete current character
d - delete things
dw - delete word
dnw - delete n words
de - delete word but not space
d$ - delete to end of line
dd - delete line
dnd - delete n lines
p - put
i - insert text
o - Open line and enter insert mode
a - append text
A - append to end of line
:!command - execute external command
:r filename - read filename into current file
:w (name) - write (to file name)
:n,n w (name) - write lines n to n (to file name)
:q! - quit without prompting
mx - mark current position as x
`x - move to mark x
'x - Move to start of line containing mark x
:marks - list current marks
guw - Change current word to lower case
gUw - Change current word to upper case
yw - yank current word
v - visual mode (select)
I hope that helps any prospective Vi users. If not, run through vimtutor and make your own :P
0 Comments:
Post a Comment
<< Home