I've searched online for this a while, but I couldn't find an answer.
What I want to do is to edit the previously entered search text in vim.
For example, say I just searched for "FooClass". Then I want to search for "FooMethod", but rather than typing the whole word from scratch, I would like to backspace 5 times to remove "Class", and just type "Method" after "Foo".
Thanks!
Press / then Up, then backspace five times. (Probably assumes nocp
is set).
Stop reading now unless you want to learn some fancy new tricks...
If you want to get clever, you can also use Ctrl-R
to pull things onto the search box (e.g. put the cursor on a word, press /, then press and hold Ctrl and press R then W and it will pull the word under the cursor onto the search line: similar to pressing *, but editable and without the word boundaries).
If you want to get really clever, you can use all of vimscript's cleverness to set @/
to be whatever you want to search for and then press n:
:let @/ = 'Foo' . 'Method'
n
Probably more than you wanted to know though...
See:
:help 'nocp'
:help c_CTRL-R
:help c_CTRL-R_CTRL-W
:help *
:help quote/
:help :let-@
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With