- ** 输入 dw 可以从光标处删除至一个单词的末尾。**
- # example
- ---> Tha words don't |belong paper in this sentence.
- $ dw
- ---> Tha words don't paper in this sentence.
- ** 输入 d$ 从当前光标删除到行末。**
- # example
- ---> |Somebody typed the end of this line twice. end of this line twice.
- $ d$
- ---> |
- 许多改变文本的命令都由一个操作符和一个动作构成。
- 使用删除操作符 d 的删除命令的格式如下:
-
- d motion
-
- 其中:
- d - 删除操作符。
- motion - 操作符的操作对象(在下面列出)。
-
- 简单的动作列表:
- w - 从当前光标当前位置直到下一个单词起始处,不包括它的第一个字符。
- e - 从当前光标当前位置直到单词末尾,包括最后一个字符。
- $ - 从当前光标当前位置直到当前行末。
-
- 因此输入 de 会从当前光标位置删除到单词末尾。
- ** 在动作前输入数字会使它重复那么多次。 **
- # example
- ---> This is just a |line with words you can move around in.
- 1. 输入 2w 使光标向前移动两个单词。
- ---> This is just a line with |words you can move around in.
- 2. 输入 3e 使光标向前移动到第三个单词的末尾。
- ---> This is just a line with words you can| move around in.
- 3. 输入 0 (数字零) 移动光标到行首。
- ---> |This is just a |line with words you can move around in.
- # 使用格式
- d number(数字) motion
- # example
- ---> this |ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
- $ d2w
- ---> this |line FGHI JK LMN OP of words is Q RS TUV cleaned up.
- $ d3e
- ---> this line |OP of words is Q RS TUV cleaned up.
- ** 输入 dd 可以删除整一个当前行。 **
- # exmample
- ---> |1) Roses are red,
- ---> 2) Mud is fun,
- ---> 3) Violets are blue,
- ---> 4) I have a car,
- ---> 5) Clocks tell time,
- ---> 6) Sugar is sweet
- ---> 7) And so are you.
- $ dd
- |---> 2) Mud is fun,
- ---> 3) Violets are blue,
- ---> 4) I have a car,
- ---> 5) Clocks tell time,
- ---> 6) Sugar is sweet
- ---> 7) And so are you.
- $ 2dd
- |---> 4) I have a car,
- ---> 5) Clocks tell time,
- ---> 6) Sugar is sweet
- ---> 7) And so are you.
- ** 输入 u 来撤消最后执行的命令,输入 U 来撤消对整行的修改。 **
- ** CTRL-R 重做被撤消的命令 **
其中: