[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] On matching the zero-width vim atom "%V"
From: |
Greg Chicares |
Subject: |
[lmi] On matching the zero-width vim atom "%V" |
Date: |
Mon, 25 Jan 2021 21:55:21 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
Here's something that I think should work, but doesn't.
Goal: in this line:
InvariantValues().TermSpecAmt[j] = TermSpecAmt;
I want to call dblize() on the RHS, making it this:
InvariantValues().TermSpecAmt[j] = dblize(TermSpecAmt);
Technique: visually highlight the string to be replaced,
e.g. with this sequence of commands on that line:
$FTvt;
and then perform the substitution:
:'<,'>s/\%V.*\%V/dblize(&)/
(The "$FT" part is written to make the command easy to
reproduce--it's not the way I'd normally begin a selection.)
That fails, yielding:
InvariantValues().TermSpecAmt[j] = dblize(TermSpecAm)t;
It works if I highlight one more character ('f', not 't'):
$FTvf;
:'<,'>s/\%V.*\%V/dblize(&)/
InvariantValues().TermSpecAmt[j] = dblize(TermSpecAmt);
But earlier I excluded that terminal ';' from the selection
because I don't want to operate on it--I don't want
InvariantValues().TermSpecAmt[j] = dblize(TermSpecAmt;)
which is what I would expect when highlighting includes ';'.
Similarly, if the string to be replaced extends to EOL:
,NetPmts[Month]
then "$FNvg_" highlights the string I want to replace,
but to use the "s" command above I must instead highlight
it with "$FNv$", which, jarringly, extends the selection
for two (not one) pseudo characters past the end.
(I don't think this is caused by any unusual vim setting,
but lmi's 'gwc/.vimrc' gives my full configuration).
What am I misunderstanding?
- [lmi] On matching the zero-width vim atom "%V",
Greg Chicares <=