Skip to content

Instantly share code, notes, and snippets.

@wiccy46
Last active November 30, 2020 08:08
Show Gist options
  • Save wiccy46/3939202d00e1449ce9246a5f5b66d28a to your computer and use it in GitHub Desktop.
Save wiccy46/3939202d00e1449ce9246a5f5b66d28a to your computer and use it in GitHub Desktop.
[vimbasic]collection of vim basic #vim
Movement:
0 -- 到行头
$ -- 到行尾
fx -- 下一个x
; -- 重复 f t F T
^ b -- 倒一页
^ f -- 进一页
zt or z<CR> -- Move current line top of the screen
z. or zz -- Move cl center of screen
z- or zb -- Bottom
Insert:
I -- 行头输入
A -- 行尾输入
cc -- 整行换
ci" -- change inside ""
dw -- 删词
多文件
:e file -- 打开文件到新buffer
:bd -- 关buffer
:sp file -- 开文件分屏
^ ww -- 换屏
CTRL-^ -- Previous buffer
Search
/pattern -- 搜
?pattern -- 反向搜
n -- 正向重复搜
N -- 反向重复搜
%s/old/new/gc -- refactor, with confirmation
Edit:
:5,7m 21 -- move lines 5, 6 and 7 to after line 21
:5,7m 0 -- move lines 5, 6 and 7 to before first line
:5,7m $ -- move lines 5, 6 and 7 to after last line
# Find and replace
:6,10s/<search_string>/<replace_string>/g | 14,18&&
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment