Is there a way edit command line or search history? I have read Is there search and replace history in vim? and tried using q: to open the history and do changes there, but all it seems to be able to do is take an edited line, execute it and append it to the history.
What I want to do is just replace a line in history (in-place) without necessarily executing it.
Use case: I try to create a plugin, that appends words under the cursor to the search (when the user presses a button). The most part is done by changing the @/ register. But I also want to update the original search command so that a user can actually find the command that would issue the modified search. I could simply re-execute the search, but then the history would get flooded.
Buffer: This is some fine text in the buffer.
User enters: "/some", the cursor goes to "some" and the last line in search history will contain "/some". Then, the user moves the cursor to "text", presses a certain key and text is added to the search term. So now, the search term would be "/some\|text".
I would like to change/overwrite the last line in search history to be "/some\|text".