There is already a question regarding how to copy text in commandline in Vim. There are two alternative answers:
":p, and- Ctrl+F, followed by finding the previous command.
But these methods don’t work when the previous command is a search. That is if I enter into command mode with / or ?, then the search term used cannot be accessed with these methods.
Is there a way to copy text for search text as well?
I believe you are looking for the
/register. You can use"/pto paste the last search. While on the command-line you can use<c-r>followed by a register to insert the contents of the given register. example:<c-r>/will paste the last search.You may also wish to use
q/to do more extensive editing of your previous searches.