Vim User Manual 阅读笔记 User_04.txt Making small changes 作微小改动

*04.1* Operators and motions 操作符和移动

小写 d4w 和 d4e 有一点点差别,

|-----|-------------------------------------------------|
| d4w | 删完之后停留在第5个词首部,删除从(当前字符 到 第四个词末尾)且不留第四个词末尾的空格; |
| d4e | 删完之后停留在第5个词前的空格,删除从(当前字符 到 第四个词末尾)且保留第四个词末尾的空格; |

Operation-motion

04.2* Changing text 改动文本

用 c

c2w

cw ce 一样

删除整行 dd

修改整行 cc

修改至行末c ,等价 d 然后 a insert mode

SHORTCUTS

Some operator-motion commands are used so often that they have been given a

single-letter command:

x stands for dl (delete character under the cursor)

X stands for dh (delete character left of the cursor)

D stands for d$ (delete to end of the line)

C stands for c$ (change to end of the line)

s stands for cl (change one character)

S stands for cc (change a whole line)

WHERE TO PUT THE COUNT 把计数放在哪边

|----------|------------------------|
| 数字-操作 | 将 3dw 理解为 3(dw),做三次dw |
| 操作-数字-操作 | 将 d3w 理解为:开始删除,往右移动三个w |

REPLACING WITH ONE CHARACTER 以一个字符代替

r小写 按下去之后等待输入,不需要按 Esc

*04.3* Repeating a change 重复一个改动

英文句号. 重复最近一次的变化, except for "u" (undo), CTRL-R (redo) and commands that start with a colon (:).

*04.4* Visual mode 可视化模式

SELECTING LINES

按小写v进入 可视化模式

按大写V,整行可视化,上下移动整行选择

SELECTING BLOCKS 选择块,块选择

块选择 CTRL-V 选择块,按块选择

可视化模式visual模式下,o命令在两端切换,块选择模式下,大写O在各个角之间切换。与在常规模式下不同。

*04.5* Moving text 移动文本

dd删除整行

p, put

P, put before cursor

SWAPPING TWO CHARACTERS 交换两个字符

小写xp

*04.6* Copying text 复制文本

The "y" operator copies text into a register. Then a "p" command

can be used to put it.

Yanking yw/ye/yy

|-----|--------------|
| 大写D | 删除当前位置到行末的内容 |
| 大写Y | 复制当前位置到行末的内容 |

*04.7* Using the clipboard 使用剪贴板

使用系统剪贴板

To copy a line to the clipboard: >

"*yy

To put text from the clipboard back into the text: >

"*p

More about the clipboard can be found in section |09.3| and here: |clipboard|.

*04.8* Text objects 文本对象

光标在词中间,需要删除整词,daw,附带删除后续的所有空格,如果在行末就把该词前面的空格也删除

aw是一个text object

cis, is for "Inner Sentence" 一句话中间,修改不包括句末空格,保留句末空格。

cas, as "A Sentence",修改包括句末空格,不保留句末空格。

同理 das/dis

可使模式下, visual mode, as/is可以进行选择;

也可以直接用 vas/vis 进行选择

似乎基于编辑器对英文标点的理解,对英文比较有效,对中文不太友好。

*04.9* Replace mode 替换模式

R 一直改到 esc; r 改一个字符

R时候,用<backspace>可以局部回复

x delete character under the cursor (short for "dl")

X delete character before the cursor (short for "dh")

D delete from cursor to end of line (short for "d$")

dw delete from cursor to next start of word

db delete from cursor to previous start of word

diw delete word under the cursor (excluding white space)

daw delete word under the cursor (including white space)

dG delete until the end of the file

dgg delete until the start of the file

相关推荐
爱吃生蚝的于勒13 小时前
【Linux】进程间通信之匿名管道
linux·运维·服务器·c语言·数据结构·c++·vim
claider1 天前
Vim User Manual 阅读笔记 User_03.txt move around
笔记·编辑器·vim
火山引擎开发者社区3 天前
当 veDB 遇上 AI:云原生数据库的智能诊断创新,覆盖重保/应急全场景
vim
Eternity∞3 天前
基于Linux系统vim编译器情况下的C语言学习
linux·c语言·开发语言·学习·vim
LingRannn3 天前
【vim 中如何替换】
编辑器·vim·excel
lixzest6 天前
Vim 快捷键速查表
linux·编辑器·vim
2501_9445937412 天前
天津半条鱼设计公司的VI设计服务如何?
vim
薛定谔的猫-菜鸟程序员13 天前
基于Node.js+Pandoc实现Markdown文件无损转换为Word文档的小工具
node.js·word·vim