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

相关推荐
智渊AI9 天前
Ubuntu 20.04/22.04 下通过 NVM 安装 Node.js 22(LTS 稳定版)
ubuntu·node.js·vim
硬汉嵌入式9 天前
Vim 9.2版本正式发布
编辑器·vim
学嵌入式的小杨同学9 天前
嵌入式硬件开发入门:PCB 设计核心流程 + 基础元器件实战指南
vscode·后端·嵌入式硬件·架构·vim·智能硬件·pcb工艺
Eternity∞10 天前
数据结构基础
c语言·开发语言·数据结构·学习·vim
晚风_END14 天前
Linux|操作系统|小技巧---vim编辑的脚本自动添加shebang 和注释
linux·运维·vim
我怎么又饿了呀15 天前
Linux 下 的Vim/Vi 操作指南
linux·运维·vim
QmZVLlLHvXq17 天前
3D CNN-GRU-Att结合模型:负荷预测、PM2.5预测、光伏预测等实验的代码实现
vim
承渊政道18 天前
Linux系统学习【深入剖析Git的原理和使用(下)】
linux·服务器·git·学习·gitee·vim·gitcode
嵌入小生00719 天前
线程 --- 嵌入式(Linux)
linux·vscode·vim·嵌入式·线程·进程
蜡笔小炘21 天前
Haproxy -- 动/静/混合态算法实验
运维·服务器·vim·haproxy