2014-10-03 749 views
3

vimtutor提示我發現在2.3課如下:vim中de和dw有什麼區別?

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. 

不過,我沒有看到W¯¯和dËd之間的差異。什麼是使用時的使用案例dw and de

回答

6

具有這樣的緩衝液:在ipsum字的中間

Lorem ipsum dolor 

移動光標():

Lorem ip▒um dolor 

現在按dÊ

Lorem ip▒dolor 

光標刪除當前單詞中的字母,直到結束,但沒有空格。

在做d 瓦特,空間將被刪除:

Lorem ip▒olor 
3

dw意思是 「從這裏切下一個單詞」。

before: fo[o]bar baz 
     dw 
after: fo[b]az 

de表示「從這裏切換到當前單詞的結尾」。

before: fo[o]bar baz 
     de 
after: fo[ ]baz