¿Qué hace CTRL+V en vim?

¿Qué hace CTRL+V en vim?

En vim mientras estoy en insertmodo, si presiono CTRL+V me arrojan a lo que se conoce como x mode (^[,^D...)y cuando presiono una tecla (la tecla Escape, por ejemplo) termino con ^[o algo más que comienza con ^. También se vuelve verde en mi editor.

¿Qué es esto y para qué se utiliza?

Respuesta1

De:h i_CTRL-V(el i_indica el modo de inserción):

                                                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.

Entonces, cuando lo haces ^v Esc, literalmente estás ingresando el Esccarácter en el texto; Vim no hará lo que suele hacer. El Escpersonaje generalmente se representa como ^[el ^ser Ctrl, y al presionar Ctrl[generalmente obtendrás el equivalente a presionar Esc.

ElPágina de manual de Ubuntu ASCIIes útil para visualizar el mapeo:

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    [

En Shifteste caso no tiene ningún efecto, Vim ve lo mismo que cuando presiona CtrlV. Intenta CtrlVCtrlVy CtrlVCtrlShiftV.

información relacionada