Vim工具使用备忘
intent Act Repeat Reverse
Make a change {edit} . u
Scan line for next character f{char}/ t{char} ; ,
Scan line for previous character F{char}/ T{char} ; ,
Scan document for next match /pattern<CR> n N
Scan document for previous match ?pattern<CR> n N
Perform substitution :s/target/replacement & u
Execute a sequence of changes qx{changes}q @x u
* 匹配当前选中的单词
:h key-notation 查看组合键位的用途
Keystrokes Effect
<Esc> Switch to Normal mode
<C-[> Switch to Normal mode
<C-o> Switch to Insert Normal mode
<c-r> 粘贴内容,insert mode
<c-v>code 插入编码代表的字符
ga 显示当前字符的编码
Command Effect
<Esc> Switch to Normal mode
v Enable character-wise Visual mode
V Enable line-wise Visual mode
<C-v> Switch to block-wise Visual mode
gv Reselect the last visual selection
o Go to other end of highlighted text
Symbol Address
1 First line of the file
$ Last line of the file
0 Virtual line above first line of the file
. Line where the cursor is placed
‘m Line containing mark m
‘< Start of visual selection
‘> End of visual selection
% The entire file (shorthand for :1,$)
@: repeat the ex commands
Command Effect
<C-w>s Split the current window horizontally
<C-w>v Split the current window vertically
:sp {file} Split the current window horizontally
:vsp Split the current window vertically
Command Effect
<C-w>w Cycle between open windows
<C-w>h Focus the window to the left
<C-w>j Focus the window below
<C-w>k Focus the window above
<C-w>l Focus the window to the right
Ex Command Normal Command Effect
:cl[ose] <C-w>c Close the active window
:on[ly] <C-w>o Keep only the active window, closing all others
Keystrokes Buffer Contents
<C-w>= Equalize width and height of all windows
<C-w>_ Maximize height of the active window
<C-w>| Maximize width of the active window
[N]<C-w>_ Set active window height to [N] rows
[N]<C-w>| Set active window width to [N] columns
Command Effect
<C-w>T Move the current window into its own tab
:tabc[lose] Close the current tab page and all of its windows
:tabo[nly] Keep the active tab page, closing all others
:tabe[dit] {file} Open {filename} in a new tab
Ex Command Normal Command Effect
:tabn[ext] {N} {N}gt Switch to tab page number {N}
:tabn[ext] gt Switch to the next tab page
:tabp[revious] gT Switch to the previous tab page
Command Move cursor
h One column left
l One column right
j One line down
k One line up
Keystrokes Buffer Contents
iw Current word
aw Current word plus one space
iW Current WORD
aW Current WORD plus one space
is Current sentence
as Current sentence plus one space
ip Current paragraph
ap Current paragraph plus one blank line
Command Effect
[count]G Jump to line number
% Jump to matching parenthesis
(/) Jump to start of previous/next sentence
{/} Jump to start of previous/next paragraph
H/M/L Jump to top/middle/bottom of screen
gf Jump to file name under the cursor
<C-]> Jump to definition of keyword under the cursor
’{mark} / `{mark} Jump to a mark
//pattern <CR> /?pattern <CR> / n / N Jump to next/previous occurrence of pattern
Register Contents
"_ black hole register
"+ system clipboard
"* selection registers
"% Name of the current file
"# Name of the alternate file
". Last inserted text
": Last Ex command
"/ Last search pattern
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。