In a BufWritePre
to remove trailing spaces, my function uses a search/replace for \s\+$
over the current buffer. So after saving any buffer, this weird entry \s\+$
shows up in my search history. Is there a way to search-and-do-not-append-history? Or can a search history entry be automatically deleted (for example, the most recent entry)?
1 Answer
Perhaps you have an autocommand that is searching for trailing whitespace on save? That is what \s\+$
is searching for.
-
yes, that was it, and I changed the question accordingly. Commented Oct 14, 2020 at 11:50
.vimrc
(which I figured out about 3 seconds after posting), so I changed the question, since it is still a problem.:h :keeppatterns
keeppatterns
on my first google search and it's the top result. The search term: "vim don't overwrite search history". Top result: Vim search without overwriting "/ register (In this case the search term was quite straightforward, TBH. What did you look for, if you don't mind saying?)