# 2021-01-05 #「Vim」- Vi IMproved
Column 1 | DESCRIPTION |
---|---|
D / d$ | 从当前光标位置开始,删除到行尾 |
v | 进入Visual模式,可以选择 |
y | 复制 |
p | 粘贴 |
V、d、p | 剪切 |
全选:ggVG
从文件中读取内容,然后插入当前位置::-1.read<filename>
行号::set number
移动光标
功能 | 命令 |
---|---|
第一行开始 | gg |
最后一行结束 | G |
执行命令
功能 | 命令 |
---|---|
使用XMLINT格式化 | ggVG:、 !xmllint --format - |
重复输入 | Ctrl+O 、 80 、 i 、 - 、 ESC |
替换操作
功能 | 命令 |
---|---|
替换命令 | :%s/search/replace/g |
将字符替换为换行 | :%s/char/r/g |
!!!替换操作是正则替换,因此特殊字符需要转义。
文本删除
功能 | 命令 |
---|---|
从光标位置开始,删除到行尾 | d $ |
参考文献
- K4NZ/Vi IMproved
- Wikipedia/Vim (text editor)
- Delete from cursor to end of line on VI
- what is the command for “Select All” in vim and VsVim?
- Vim indent xml file
- Vim tips: The basics of search and replace
- Repeating characters in VIM insert mode
- Copy, cut and paste
- How To Show or Hide Line Numbers In vi / vim Text Editor
- Vim: insert text from a file at current cursor position
- How to replace a character by a newline in Vim
- Find and replace using regular expressions
- Delete from cursor to end of line in `vi`