[TOC]
- ds - 删除一个 surrounding
- cs - 改变一个 surrounding
- ys - 增加一个 surrounding
- yS - 将文本放在新行并在上下增加 surrounding(个人感觉没啥卵用
- yss - ys的整行操作
- ySs - yS的整行操作
- ySS - 与 ySs 相同
s - 增加一个 surrounding S - 将文本放在新行并在上下增加 surrounding(个人感觉没啥卵用
<CTRL-s>
- 增加一个 surrounding
<CTRL-s><CTRL-s>
- 将文本放在新行并在上下增加 surrounding(个人感觉没啥卵用
<CTRL-g>s
- 与 <CTRL-s>
相同
<CTRL-g>S
- 与 <CTRL-s><CTRL-s>
相同
(以下 * 代表光标处)
文本 | 命令 | 结果 |
---|---|---|
"Hello *world!" | cs"' | 'Hello world!' |
"Hello *world!" | cs" | Hello world! |
(123+4*56)/2 | cs)] | [123+456]/2 |
(123+4*56)/2 | cs)[ | [ 123+456 ]/2 |
<div>foo*</div> |
cst<p> |
<p>foo</p> |
fo*o! | csw' | 'foo'! |
fo*o! | csW' | 'foo!' |
Text | Command | New Text |
---|---|---|
Hello w*orld! | ysiw) | Hello (world)! |
Hello w*orld! | csw) | Hello (world)! |
fo*o | ysiwt<html> |
<html>foo</html> |
foo quu*x baz | yss" | "foo quux baz" |
foo quu*x baz | ySS" | "foo quux baz |
只需ds(surrounding)
即可 不加()
<leader>cc
注释当前行和选中行<leader>cu
取消当前行的注释<leader>cs
以"性感"的方式注释当前行<leader>ci
执行反注释操作 即注释未被注释的 取消注释 已被注释的<leader>ca
转换默认的注释方式 eg.c++的// 与/* */<leader>c$
从光标开始到行尾注释number<leader>cc
光标以下number行添加注释number<leader>cu
光标以下number行取消注释number<leader>cm
光标以下number行添加块注释
Normal模式下,几乎所有命令前面都可以指定行数 Visual模式下执行命令,会对选中的特定区块进行注释/反注释
//个人觉得常用的就这么几个 以后可以更新