2.1 简单命令

  1. ** 输入 dw 可以从光标处删除至一个单词的末尾。**
  2. # example
  3. ---> Tha words don't |belong paper in this sentence.
  4. $ dw
  5. ---> Tha words don't paper in this sentence.

2.2 更多删除

  1. ** 输入 d$ 从当前光标删除到行末。**
  2. # example
  3. ---> |Somebody typed the end of this line twice. end of this line twice.
  4. $ d$
  5. ---> |

2.3 命令和对象

  1. 许多改变文本的命令都由一个操作符和一个动作构成。
  2. 使用删除操作符 d 的删除命令的格式如下:
  3. d motion
  4. 其中:
  5. d - 删除操作符。
  6. motion - 操作符的操作对象(在下面列出)。
  7. 简单的动作列表:
  8. w - 从当前光标当前位置直到下一个单词起始处,不包括它的第一个字符。
  9. e - 从当前光标当前位置直到单词末尾,包括最后一个字符。
  10. $ - 从当前光标当前位置直到当前行末。
  11. 因此输入 de 会从当前光标位置删除到单词末尾。

2.4 重复动作计数器

  1. ** 在动作前输入数字会使它重复那么多次。 **
  2. # example
  3. ---> This is just a |line with words you can move around in.
  4. 1. 输入 2w 使光标向前移动两个单词。
  5. ---> This is just a line with |words you can move around in.
  6. 2. 输入 3e 使光标向前移动到第三个单词的末尾。
  7. ---> This is just a line with words you can| move around in.
  8. 3. 输入 0 (数字零) 移动光标到行首。
  9. ---> |This is just a |line with words you can move around in.

2.5 删除更多

  1. # 使用格式
  2. d number(数字) motion
  3. # example
  4. ---> this |ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
  5. $ d2w
  6. ---> this |line FGHI JK LMN OP of words is Q RS TUV cleaned up.
  7. $ d3e
  8. ---> this line |OP of words is Q RS TUV cleaned up.

2.6 删除整行

  1. ** 输入 dd 可以删除整一个当前行。 **
  2. # exmample
  3. ---> |1) Roses are red,
  4. ---> 2) Mud is fun,
  5. ---> 3) Violets are blue,
  6. ---> 4) I have a car,
  7. ---> 5) Clocks tell time,
  8. ---> 6) Sugar is sweet
  9. ---> 7) And so are you.
  10. $ dd
  11. |---> 2) Mud is fun,
  12. ---> 3) Violets are blue,
  13. ---> 4) I have a car,
  14. ---> 5) Clocks tell time,
  15. ---> 6) Sugar is sweet
  16. ---> 7) And so are you.
  17. $ 2dd
  18. |---> 4) I have a car,
  19. ---> 5) Clocks tell time,
  20. ---> 6) Sugar is sweet
  21. ---> 7) And so are you.

2.7 撤销命令

  1. ** 输入 u 来撤消最后执行的命令,输入 U 来撤消对整行的修改。 **
  2. ** CTRL-R 重做被撤消的命令 **

总结

  1. 欲从当前光标删除至下一个单词,请输入: dw
  2. 欲从当前光标删除至当前行末尾,请输入: d$
  3. 欲删除整行,请输入: dd
  4. 欲重复一个动作,请在它前面加上一个数字: 2w
  5. 在正常模式下修改命令的格式是:operator [number] motion其中:operator - 操作符,代表要做的事情,比如 d 代表删除[number] - 可以附加的数字,代表动作重复的次数motion - 动作,代表在所操作的文本上的移动,例如 w 代表单词(word),$ 代表行末等等。
  6. 欲移动光标到行首,请按数字0键: 0
  7. 欲撤消以前的操作,请输入: u (小写的u) 欲撤消在一行中所做的改动,请输入: U (大写的U) 欲撤消以前的撤消命令,恢复以前的操作结果,请输入: CTRL-R