在 vim 中更改引号后的词?
Change word after quotation in vim?
我知道您可以使用 cw
更改单词,使用 ciw
更改内部单词,但我想做的是更改字符后的单词。
例如我有这个
this.option('test');
现在我的光标位于第一个引号 (') 处,我想更改单词 test。如果我按 cw
它也会删除我光标所在的第一个引号。另一方面,我正在寻找一个模仿 a
模式的命令(它在光标后插入),所以在我的例子中删除光标后的单词并将其置于插入模式?
cw
不是 "change the word",而是 "change to next word".
将光标放在任一单引号上,您可以使用 ci'
到 "change between single quotes"。
将光标放在第一个单引号上,您还可以这样做:
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
。
如果您的光标位于 ( ' ),您可以使用
ci'
这将删除 文本 并将您设置为插入模式以进行更改。
因此 '.
内部发生了变化
我知道您可以使用 cw
更改单词,使用 ciw
更改内部单词,但我想做的是更改字符后的单词。
例如我有这个
this.option('test');
现在我的光标位于第一个引号 (') 处,我想更改单词 test。如果我按 cw
它也会删除我光标所在的第一个引号。另一方面,我正在寻找一个模仿 a
模式的命令(它在光标后插入),所以在我的例子中删除光标后的单词并将其置于插入模式?
cw
不是 "change the word",而是 "change to next word".
将光标放在任一单引号上,您可以使用 ci'
到 "change between single quotes"。
将光标放在第一个单引号上,您还可以这样做:
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
。
如果您的光标位于 ( ' ),您可以使用
ci'
这将删除 文本 并将您设置为插入模式以进行更改。
因此 '.
内部发生了变化