[ANN] Understanding Vim's excalamation mark command quoting/escaping rules

[ANN] Understanding Vim's excalamation mark command quoting/escaping rules

Daniel Shahaf d.s at daniel.shahaf.name
Fri Apr 1 09:03:56 IDT 2016


Shlomi Fish wrote on Thu, Mar 31, 2016 at 22:56:28 +0300:
> I prepared a document where I investigated which characters need to be
> escaped in vim's ":!" commands of filtering the text through a shell
> command.

The escape rules are documented:

    :help cmdline-special

> Executive summary:
> 
> - “%”, “#”, and “!” should be escaped with a backslash (“\”).
> 
> - All other punctuation/special characters (including a backslash)
> need not and should not be escaped.

Beyond [%#!] which you mention, there are also:

- «<cword>» and friends

- The envvars $MYVIMRC, $VIM, $VIMRUNTIME are available (:help $VIM,
  :help $MYVIMRC)

- A literal LF (ASCII 0x0A) can't be entered (:help NL-used-for-NUL)

Cheers,

Daniel



More information about the Linux-il mailing list