Reply to message «Re: How to execute :s command without adding the search pattern to the search history?», sent 10:27:50 14 June 2011, Tuesday by Ben Schmidt:
> Can't you just use histdel() after :s or :/ to get the unwanted entry
> out of history?
Consider the following situation: you have ten items in history, fifth item is
{pattern}. Function that utilizes histdel() appeared to use {pattern} for some
reason too. If you run histdel() at this point, fifth item will disappear. If
you won't, fifth item will be moved. Solution: save and delete the whole
history, then clean history again and restore (code posted by me earlier does
not do cleaning, though fix is obvious).
Original message:
> On 13/06/11 10:52 PM, Charles Campbell wrote:
> > lith wrote:
> >> Hi,
> >>
> >> Is there a way to execute the :s or :/ command from a script without
> >> adding any patterns to the search history. I.e. is there a command like
> >> :keephistory (similar to :keepjumps) or any other solution that let's
> >> me execute a command without changing the search history?
> >
> > For :s, use substitute().
> > For :/, use search().
>
> Can't you just use histdel() after :s or :/ to get the unwanted entry
> out of history?
>
> Ben.
signature.asc
Description: This is a digitally signed message part.
