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

相关推荐
烂蜻蜓2 小时前
Node.js入门教程(二十三):全局对象
node.js·编辑器·vim
琥珀色糖1 天前
Linux Vim的使用
linux·运维·服务器·vim·vim使用
FlightYe3 天前
linux系统编程(八):阻塞与非阻塞IO对比
android·linux·运维·服务器·github·vim
爱和冰阔落6 天前
【Linux】两个毫无关系的进程怎么通信?命名管道 FIFO 从原理到 Server/Client 实战
android·linux·数据库·c++·vim
FeelTouch Labs9 天前
Node.js 中的 spawn 和 exec:子进程执行的不同方式对比
node.js·编辑器·vue·vim
邪修king10 天前
Re:Linux系统篇(七) 开发工具篇 Chapter3:Makefile 从入门到精通 —— 依赖关系、伪目标、栈式推导与自动化构建全解
linux·运维·服务器·vim
赵庆明老师13 天前
Vben精讲:21-详解web-antd:tsconfig.json
前端·json·vim
听风34714 天前
LazyVim 使用教程与快捷键指南
vim·neovim·lazyvim
XCDoris15 天前
湖南文旅vi设计包含哪些核心要素及视觉规范有哪些讲究?
vim
云泽80816 天前
Linux基础开发工具(三):Vim高级配置、Swap恢复机制与Sudo权限白名单详解
linux·运维·vim