Reputation: 1594
Is there a list of them?
I have a trouble when I want to replace {inspect.stack()[0][3]}
to {inspect.stack()[0][3]} called from {inspect.stack()[1][3]}
in my python code.
And I cannot find a full list from internet.
Upvotes: 7
Views: 872
Reputation: 172510
:substitute
(the command)To do a literal substitution, specify "very-nomagic" :help /\V
(or escape all special search characters ^$.*[~
) and "case-sensitive" /\C
, and escape the :substitute
separator (usually /
) and any backslashes (\
) in the source. Line breaks must be changed from ^M
to \n
. Taken together, for the pattern:
'\V\C' . substitute(escape(literalPattern, '/\'), "\n", '\\n', 'ge')
In the replacement, &
and ~
must be escaped (in addition to /
and \
) if the 'magic'
option is set. (\V
doesn't work here). Cp. :help sub-replace-special
escape(literalReplacement, '/\' . (&magic ? '&~' : ''))
substitute()
(the function)Something similar applies to substitute()
as well; &
must always be escaped, as 'magic'
is always set, and only ~
must not be escaped:
substitute(input, '\V\C' . escape(literalPattern, '\'), escape(literalReplacement, '\&')), 'g')
Upvotes: 4