Tim Chase wrote:
In a script, how do I get the value of ~ -- the last used
replace-to string, as used in s//~/ ?

While I've wondered this in the past, and don't have an answer at
the moment, I found a small bug in the help text (or in the :help
command) while hunting.

In Vim7, if I type

        :help ~

and hit control+D to expand the available help items, one of them is

        s/\~

However, if I type

        :help s/\~

and hit <enter>, Vim returns

 E33: No previous substitute regular expression
 E149: Sorry, no help for s/\~

According to a helpgrep (which had to be entered as

        :helpgrep s/\\\~

), there's only one location in the help where this matches,
right next to

        :help s~

I suspect it's a bug for control+D expansion to return something
that, if chosen as the help tag, refuses to jump there.

-tim





I don't get an error but I get a wrong matching anyway. Here, ":help s/\~" goes to the helptag for s/\& (s/\~ is 12 lines further down).

To find the tag for s/\~ I have to enter ":help s/\\~". ":help s/\\\~" jumps to s/\\


Best regards,
Tony.
--
Most people wouldn't know music if it came up and bit them on the ass.
                -- Frank Zappa

Reply via email to