Vim 范围内的选择
Selection surrounding in Vim
在 vim 中包围选定文本的最佳方式是什么?
例如
cout << this is some statement << endl;
我想用“”快速将此语句括起来
cout << "this is some statement" << endl;
使用 vim-surround 满足您周围的所有需求。
安装后,如果您的光标位于 "this" 的 "t" 上,请键入 yst<"
以完成您想要的:
ys<text object><type>
用类型的东西包围文本对象。
我喜欢并使用 Surround,但使用原版 Vim 非常简单:
c"<C-r>""<Esc>
表示"change the selected text (c
) to a double quote ("
), then insert the content of the unnamed register (<C-r>"
), followed by another double quote ("
), and leave insert mode (<Esc>
)".
见:help i_ctrl-r
。
在 vim 中包围选定文本的最佳方式是什么?
例如
cout << this is some statement << endl;
我想用“”快速将此语句括起来
cout << "this is some statement" << endl;
使用 vim-surround 满足您周围的所有需求。
安装后,如果您的光标位于 "this" 的 "t" 上,请键入 yst<"
以完成您想要的:
ys<text object><type>
用类型的东西包围文本对象。
我喜欢并使用 Surround,但使用原版 Vim 非常简单:
c"<C-r>""<Esc>
表示"change the selected text (c
) to a double quote ("
), then insert the content of the unnamed register (<C-r>"
), followed by another double quote ("
), and leave insert mode (<Esc>
)".
见:help i_ctrl-r
。