How to change search text in vim?

I searched the Internet this time, but I could not find the answer.

What I want to do is edit the previously entered search text in vim.

For example, let's say I was just looking for "FooClass". Then I want to find “FooMethod”, but instead of typing the whole word from scratch, I would like to cancel 5 times to delete the “Class”, and just type “Method” after “Foo”.

Thank!

+3
source share
2 answers

Press /, then Up, then move five times. (Probably assumed to be installed nocp).


Stop reading now if you don’t want to learn some fancy new tricks ...

, Ctrl-R, (, , /, Ctrl R W, : *, ).

, vimscript, @/ , , n:

:let @/ = 'Foo' . 'Method'
n

, , , ...

:

:help 'nocp'
:help c_CTRL-R
:help c_CTRL-R_CTRL-W
:help *
:help quote/
:help :let-@
+12

, . q/. , , enter, .

vimcast .

:h q/
+9

Source: https://habr.com/ru/post/1791550/


All Articles