每当我想评论一段代码时,我都会遵循这些步骤:
Run Code Online (Sandbox Code Playgroud)1) Enter Blockwise Visual mode by hitting CTRL-V. 2) Mark the block you wish to comment. 3) Hit I (capital I) and enter your comment string at the beginning of the line. (// for C++) 4) Hit ESC and all lines selected will have
但是,我不太清楚我在那里做了什么. 为什么ESC会导致块中每行的插入.
Nat*_*man 16
块选择模式I告诉VIM切换到插入模式,光标位于块第一行的第一个字符之前.
您在第一行上键入的所有字符都将插入所选行中所有行的前面,就在所选块之前.
您也可以这样做A,除了您将在块之后添加它.
从 :help I
Run Code Online (Sandbox Code Playgroud)Insert text before the first non-blank in the line [count] times. When the 'H' flag is present in 'cpoptions' and the line only contains blanks, insert start just before the last blank.
在每个选定行之前插入
我只能假设使用了“ESC”,因为它不像 ENTER 那样是可打印的字符。
| 归档时间: |
|
| 查看次数: |
2816 次 |
| 最近记录: |