Skip to content

Instantly share code, notes, and snippets.

@a1exlism
Last active September 27, 2019 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a1exlism/5d5be82d7f447c9f7e13 to your computer and use it in GitHub Desktop.
Save a1exlism/5d5be82d7f447c9f7e13 to your computer and use it in GitHub Desktop.
基本的vim 操作(有中文) http://vim.rtorr.com/
#常用:
! 强制执行
n->Enter 向下移动n行
:s/word1/word2/g 单行替换
:n1,n2s/word1/word2/g n1行和n2行之间批量替换:word2->word1
:%s/word1/word2/g 全局替换
:s/word1/word2/gc c选项==>confirm 确认选项
nyy/ndd 复制/删除光标之下的n行
. Repeat重复
#一般:
Ctrl+<gbdu> 翻页
+- 非空格下/上一行
n<space> 光标移动n格
[y,d]0/d$ [复制/删除]光标到行首/尾字符
可视区域内:
H 左上角
M 中央
L 右下角
# file
:r[filename] 读入文件
:! command vim中执行cmd
:n1,n2 w [filename] 将n1-n2内容保存为filename
# muti file
----#Vim Option#----
:set nu /no 左侧边栏显示/关闭行号
:set ruler 右下角显示行列编号
# 多窗口
:sp [filename]
Ctrl+w =>j/k 切换窗口
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment