As my typical use of vim is applying the substitute command, I decided to
maintain a file of previously used such commands, and to grep a selection
of them back into my current buffer by providing grep with the first few
characters of the pattern for the substitute I wish to make.  For that, I
have produced this mapping:

" grep pattern from subs.vim into current buffer
imap <S-F8> \<Esc>xbPlplplplplp:s/\\*$//<CR>d$:r!grep " ^R"" subs.vim<CR>

Note ^R is the blue text produced by the sequence ^V^R

The imap RHS works as expected if run by hand as ex commands, but fails as
a mapping because one superfluous \ (inserted by the plplp sequence)
remains after the substitute that should remove them all.
e.g. the sequence /\([ is converted to \/\\\(\[\ instead of the required
\/\\\(\[

I have also tried pasting the \s from right to left and stripped
superfluous \ from the front end of the line, but got a similar result.
Any suggestions as to why this happens?

-- 
Graham Lawrence

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to