2017-09-24 34 views
0

我知道你可以使用cw改變這個詞,ciw改變內部詞,但是我想要做的是改變這個詞後面的詞。在vim中引用後改單詞?

例如,我有這個

this.option('test'); 

現在我的光標是在第一個引號('),我想改變單詞測試。如果我按cw它也會刪除我的光標所在的第一個引號。另一方面,我正在尋找一個模仿a模式(在光標之後插入的模式)的命令,所以在我的情況下刪除光標後的單詞並將其放入插入模式?

回答

3

cw不是「更改單詞」,它是「更改爲下一個單詞」

將光標放在任一單引號上,可以使用ci'「在單引號之間切換」。

隨着光標的第一單引號,你也可以這樣做:

wciw   move to next word then change inner word 
wcw   move to next word then change to next word 
wct'   move to next word then change until next single quote 
wce   move to next word then change to end of the word 

lciw   move to next character then change inner word 
lcw   move to next character then change to next word 
lct'   move to next character then change until next single quote 
lce   move to next word then change to end of the word 

<Right>ciw move to next character then change inner word 
<Right>cw  move to next character then change to next word 
<Right>ct' move to next character then change until next single quote 
<Right>ce  move to next word then change to end of the word 

:help navigation

+0

感謝您的糾正和'ci''命令。這正是我期待的! – supersan

0

如果光標在()比你可以使用

ci' 

這將刪除文本,並設置你插入模式作出改變。

所以它是'內部的變化。