On Thursday, 8 November 2012 19:04:00 UTC, Tim Chase wrote:
> > 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
Thanks a lot Tim! These mappings are much simpler, simply using Ctrl-R
to get the previous search value and the text beneath the cursor.
I like the second approach since the search is not actually made so
the cursor does not move, but it does mean search highlighting
is not turned on, which I found I missed.
I also realised I use this plugin to make * search on whatever
is highlighted in Visual Mode: http://vim.wikia.com/wiki/VimTip171
So putting it all together these are the mappings I've got now:
nnoremap £ :let
@/.='<bslash><bar><bslash><lt>'.expand('<cword>').'<bslash>>'<cr>:set hls<cr>
vnoremap £ <esc>:let @/.='<bslash><bar>'.@*<cr>:set hls<cr>
The Visual one relies on the * register being populated with
visual selections, i.e. having 'guioptions' include 'a'.
regards,
Geoff
--
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