这里有50个有用的Vim命令,在正常模式下工作。这些可以再次组合形成新的命令。使用他们能极大的提升你的工作效率。排名不分先后:
-
gg移动到文件的第一行 -
G移到最后一行 -
gg=G选择整个文件 -
gv回到最后一次定位 - ``<` 跳到最后一个视觉选择的开始Jump to beginning of last visual selection
- ``>` Jump to end of last visual selection
-
^Move to first non-blank character of the line -
g_Move the last non-blank character of the line (but you remove trailing whitespace, right) -
g_lDDelete all the trailing whitespace on the line -
eaAppend to the end of the current word -
gfJump to the file name under the cursor -
xpSwap character forward -
XpSwap character backward -
yypDuplicate the current line -
yapPDuplicate the current paragraph -
datDelete around an HTML tag, including the tag -
ditDelete inside an HTML tag, excluding the tag -
wMove one word to the right -
bMove one word to the left -
ddDelete the current line -
zcClose current fold -
zoOpen current fold -
zaToggle current fold -
ziToggle folding entirely -
<<Outdent current line -
>>Indent current line -
z=Show spelling corrections -
zgAdd to spelling dictionary -
zwRemove from spelling dictionary -
~Toggle case of current character -
gUwUppercase until end of word (u for lower, ~ to toggle) -
gUiwUppercase entire word (u for lower, ~ to toggle) -
gUUUppercase entire line -
gu$Lowercase until the end of the line -
da"Delete the next double-quoted string -
+Move to the first non-whitespace character of the next line -
SDelete current line and go into insert mode -
Iinsert at the beginning of the line -
ci"Change what’s inside the next double-quoted string -
ca{Change inside the curly braces (try [, (, etc.) -
vawVisually select word -
dapDelete the whole paragraph -
rReplace a character - ``[` Jump to beginning of last yanked text
- ``]` Jump to end of last yanked text
-
g;Jump to the last change you made -
g,Jump back forward through the change list -
&Repeat last substitution on current line -
g&Repeat last substitution on all lines -
ZZSave the current file and close it








网友评论