On 01/07/09 18:52, googler wrote:
>
> Suppose I am editing/viewing a file and searching for different
> regular expressions in the file, for example, issuing commands "/
> abcd", "/efgh", "/ijkl" and "/mnop". Since my last search was for
> "mnop", that's what I have highlighted currently. Now if I want to go
> back to the previous search or the one (or two) before that, what is
> the easiest way to do that? I do not want to type the whole search
> string again. Is there a shortcut? If not, does there exist any script
> that I can use to get this functionality?
>
> Thanks for any response on this.

Actually, there are several ways to use search history; most of them 
apply also to command history if you replace / or ? by :

- Plain history:
Hit / or ? then <Up> for "next older" or <Down> for "next newer".

- Autocomplete from history
Hit / or ? then part of the pattern. Now <Up> and <Down> will only 
"remember" the patterns which correspond to what you just typed.

- History window (with +cmdline_hist compiled-in)
Hit q/ or q? -- Vim opens a full-width window at the bottom, with all 
the latest search patterns (the newest one at bottom). Hitting <Enter> 
on any line will search for that (after closing the history window). Or 
you can edit (without leaving the window) /then/ hit Enter, to search on 
something slightly different than what you searched before. Use (for 
instance) :q if you decide to close the window without searching.


Best regards,
Tony.
-- 
Paul's Law:
        In America, it's not how much an item costs, it's how much you
save.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to