zm: fold one morezr: reduce one foldzM: fold allzR: unfold all
gn: operating on search matches(e.g.cgndgn)
>: indent operator(like>ip>wetc)<: unindent operatorV: linewise virsual mode(v-> characterwise;<ctrl-v>-> blockwise)
D: short ford$
<shift-j>: join two lines
<ctrl-n>: select next in autocomplete<ctrl-p>: select previous in autocomplete
ci): change inside parenthesesci": change inside quoteci}: change inside}
%: go to matched parentheses<shift-i>: insert at the first character<shift-a>: append at the last character^: go to the first character of current line.(0go to start of the line,$go to end of the line)
f:fofind nextoin current line. (Fto find previous one)/:/hellofind all texthelloin the file,ngo to next one,Ngo to privious one.*: go to next matched word under the cursor,#go to previous one.
ctrl-z: will suspend the process and get back to your shellfg: will resume (bring to foreground) your suspended vim
:sh(or:!bash): start a subshellctrl-d(orexit): kill the shell and return to vim
- a 在光标后插入
- i 在光标前插入
- o 在当前行后插入一个新行
- O 在当前行前插入一个新行
- cw 替换从光标所在位置后到一个单词结尾的字符
-
四个方向移动:
k h l j -
0数字零,到行头 -
^到本行第一个不是 blank 字符的位置(所谓 blank 字符就是空格,tab,换行,回车等) -
$到本行行尾 -
NG或:N→ 到第 N 行 -
gg→ 到第一行(相当于1G,或 :1) -
G→ 到最后一行 -
w→ 到下一个单词的开头 -
e→ 到下一个单词的结尾 -
%→ 匹配括号移动,包括 (, {, [ -
*和#→ 匹配光标当前所在的单词,移动光标到下一个(或上一个)匹配单词(*是下一个,#是上一个)
x删当前光标所在的一个字符,并把删除的字符存到剪贴板里dd删除当前行,并把删除的行存到剪贴板里p在(当前行/光标)后粘贴P在(当前行/光标)前粘贴yy拷贝当前行当行于 ddP
uundo<C-r>redo
:e <path/to/file>→ 打开一个文件:saveas <path/to/file>→ 另存为 <path/to/file>:bn 和 :bp→ 你可以同时打开很多文件,使用这两个命令来切换下一个或上一个文件。
.重复上次命令N<command>重复某个命令N次