在Vim中,我写完之后:
int[] no={1,2,3,4,5,6}
Run Code Online (Sandbox Code Playgroud)
我已经改变了主意,想把它变成这样的字符串:
String[] no={"1","2","3","4","5","6"};
Run Code Online (Sandbox Code Playgroud)
一旦您将手移动到箭头键并保持插入模式,这很容易.否则你需要大量的esc按键.这样做的"Vim方式"是什么?
(也有类似的问题,但我认为这个具体的例子可以很好地证明在插入模式下需要一种简单的遍历方式.)
不,您不需要为此保持插入模式.内置插件的一个选项:
0cwString<Esc>:s/\d/"&"/g
Run Code Online (Sandbox Code Playgroud)
另一个使用surround.vim插件(ysh"左边的字符用双引号括起来):
0cwString<Esc>f,ysh";;.;;.;;.;;.f}.
Run Code Online (Sandbox Code Playgroud)
我相信其他人会提出更多创造性方法......
将其与插入模式进行比较:
0cwString<Esc>f{a"<Right>"<Right>"<Right>"<Right>"<Right>"<Right>"<Right>"<Right>"<Right>"<Right>"<Right>"<Esc>
Run Code Online (Sandbox Code Playgroud)