CTRL + V在vim中做什么?


12

在vim处于insert模式时,如果按CTRL + V,则会陷入所谓的状态x mode (^[,^D...),当我按某个键(例如,逃逸键)时,我会遇到以^[或开头的其他内容^。在我的编辑器中,它也会变成绿色。

这是做什么用的?


您确定是Vim吗? Ctrl+V(无移位)在多个终端仿真器中具有此含义。也许告诉我们您正在使用哪个终端。
令人作呕的

@grochmal在Ubuntu 16.04中是vim
leeand00

Answers:


15

:h i_CTRL-Vi_指示插入模式):

                                                i_CTRL-V
CTRL-V          Insert next non-digit literally.  For special keys, the
                terminal code is inserted.  It's also possible to enter the
                decimal, octal or hexadecimal value of a character
                i_CTRL-V_digit.
                The characters typed right after CTRL-V are not considered for
                mapping.  {Vi: no decimal byte entry}
                Note: When CTRL-V is mapped (e.g., to paste text) you can
                often use CTRL-Q instead i_CTRL-Q.

因此,当您这样做时^v Esc,您实际上是Esc在文本中输入字符-Vim不会执行通常的操作。该Esc字符通常表示为^[^存在Ctrl,并按Ctrl[通常将让你按等效Esc

Ubuntu的ASCII手册页是在可视化映射有用:

010   8     08    BS  '\b' (backspace)        110   72    48    H
011   9     09    HT  '\t' (horizontal tab)   111   73    49    I
012   10    0A    LF  '\n' (new line)         112   74    4A    J
013   11    0B    VT  '\v' (vertical tab)     113   75    4B    K
014   12    0C    FF  '\f' (form feed)        114   76    4C    L
015   13    0D    CR  '\r' (carriage ret)     115   77    4D    M
...
033   27    1B    ESC (escape)                133   91    5B    [

Shift这种情况下没有任何效果,Vim看到同样的事情,当按下作为CtrlV。尝试CtrlVCtrlVCtrlVCtrlShiftV

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.