evil icon indicating copy to clipboard operation
evil copied to clipboard

Allow keybinding symbols in :normal command

Open MyriaCore opened this issue 4 years ago • 3 comments

Allow unquoted keybinding symbols (e.g. \<C-w>, \<esc>, etc) in the normal command (as described by the vim docs) would be great, since it would make the normal command useful for doing things that jump in and out of normal mode.

For example, the following:

:normal iType This Out\<cr>Type this out\<esc>
:normal iType This Out\<esc>oType it out again\<esc>

Would produce this in an empty buffer, and leave the cursor at the end of the last line:

Type this out
Type it out again

Semi-related to #1361

MyriaCore avatar Oct 05 '20 15:10 MyriaCore

Have you tried quoted-insert? It should be bound to C-v in the minibuffer.

With it you can enter literal key characters such as C-a or more importantly escape. so you can do something like:

  1. :norm Afoo
  2. C-v ESC
  3. 0ibar

and you can exit insert state in normal commands. Pretty sure vim also supports this.

mohkale avatar Oct 14 '20 09:10 mohkale

Just tried playing around w/ quoted insert. I musta broken something in my meddling, cause :norm isn't working for me in general. It seems like a pretty OK workaround, though I'd still like to see \<KBD> parising in :norm commands. That's just my take xP.

Thanks for the tip though! Didn't know quoted-insert was a thing.

MyriaCore avatar Oct 15 '20 16:10 MyriaCore

Just tested C-v, and it works pretty pretty well, although it does pollute the exec history if the user tries any : statements inside of their norm string.

MyriaCore avatar Nov 13 '20 23:11 MyriaCore