按照vimtutor
提示,我在第2.3课中找到了以下内容:
Many commands that text are made from an operator and a motion.
The format for a follows:
d motion
Where:
d - is the delete operator.
motion - is what the operator will operate on (listed below).
A short list of motions:
w - until the start of the next word, EXCLUDING its first character.
e - to the end of the current word, INCLUDING the last character.
$ - to the end of the line, INCLUDING the last character.
但是,我没有看到 d w 和 d e 之间的区别。使用 d w 和 d e 时的用例是什么?
答案 0 :(得分:12)
有这样的缓冲区:
Lorem ipsum dolor
将光标(▒
)移动到ipsum
字:
Lorem ip▒um dolor
现在按 d e :
Lorem ip▒dolor
光标删除了当前单词中的字母,直到结束,但没有空格。
在执行 d w 时,空格将被删除:
Lorem ip▒olor
答案 1 :(得分:8)
dw
表示"从这里切换到下一个单词"。
before: fo[o]bar baz
dw
after: fo[b]az
de
表示"从此处切换到当前单词的结尾"。
before: fo[o]bar baz
de
after: fo[ ]baz