Thursday, November 8, 2012

Re: Repeatedly adding new terms to the existing search pattern

> When I see another error, I have to manually get its pattern and
> add it to the search register. I do this by pressing * on it,
> then type /, 'up' twice the previous pattern, '\|' then 'Ctrl-R/'
> to append the new search to the previous one.

Am I missing something, or would the following do roughly what you
describe:

:nnoremap £ /<c-r>/<bslash><bar><c-r><c-w><cr>

or possibly

:nnoremap £ /<c-r>/<bslash><bar><bslash><lt><c-r><c-w><bslash>><cr>

(note the double ">" in the last "<bslash>>")

It sounds like you were mostly there with this solution you almost
relegate to a footnote. The only downside I see would be if you
happened to have a literal "/" in your search pattern already (or
it's included in 'iskeyword'), it would treat it as the ending
terminator for the search (before the search flags), and cause it to
choke. In that case, you should be able to use something like

:nnoremap £ :let
@/.='<bslash><bar><bslash><lt>'.expand('<cword>').'<bslash>>'<cr>

-tim



--
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

No comments: