Vimtutor记录
操作 | 功能 |
---|---|
h ,j ,k ,l |
The cursor is moved using either the arrow keys or the hjkl keys |
:q! |
trash all changes and quit Vim |
x |
delete the character at the cursor |
i |
insert before the cursor |
A |
append after the line |
:wq |
save the changes and quit Vim |
dw |
delete from the cursor up to the next word |
d$ |
delete from the cursor to the end of a line |
de |
delete from the cursor to the end of the current word |
2w |
move the cursor two words forward |
3e |
move the cursor to the end of the third word forward |
0 |
move to the start of the line |
d2w |
delete two words |
dd |
delete a whole line |
2dd |
delete two lines |
u |
undo the last commands |
dd =>p |
put back text that has just been deleted |
r |
replace the character under the cursor |
ce |
change until the end of a word |
c [number] motion |
use with w ,$ ,e to change |
G |
move to the bottom of the file |
gg |
move to the start of the file |
[number] G |
move to the [number] line |
/ =>n &N |
Type / followed by a phrase to search for the phrase |
? =>n &N |
Type ? followed by a phrase to search for the phrase inversely |
% |
find a matching ) ,] , or } |
:s/thee/the <ENTER> |
changes the first occurrence of "thee" in the line |
:s/thee/the/g |
substitute globally in the line, change all occurrences of "thee" in the line |
:#,#s/old/new/g |
where #,# are the line numbers of the range of lines where the substitution is to be done. |
:%s/old/new/g |
to change every occurrence in the whole file |
:%s/old/new/gc |
to find every occurrence in the whole file,with a prompt whether to substitute or not. |
:! |
followed by an external command to execute that command |
:w FILENAME |
save the changes made to the text |
v |
starts Visual selection |
r FILENAME |
insert the contents of a file |
o |
open a line BELOW the cursor and place you in Insert mode |
O |
open up a line ABOVE the cursor |
a |
insert text AFTER the cursor |
R |
replace more than one character |
y (Visual Model) |
copy text |
p (Visual Model) |
paste text |
:set ic |
search or substitute ignores case |
:set noic |
|
:set hls is |
set the 'hlsearch' and 'incsearch' options |
:nohlsearch |