- is there a way to copy to the search query, including the term?

If I have the following words

cat Oliver Louis

and the cursor is on "c", I can copy to the beginning of Louis with y/Louis<CR>(where "CR" is the enter key), which will copy the line "cat Oliver".

Is there a way to copy the search term β€œLouis” as well as for the copied string β€œOliver Louis cat”? Thanks in advance.

+4
source share
3 answers

Use modifier /e: y/Louis/e<CR>. If you want to repeat the last search pattern, just leave him y//e<CR>.

:help search-offset
+10
source

/ , , . ( :help exclusive)

f t.

:

cat Oliver Louis

yfs , "s" cat Oliver Louis

, ,

cat Assassins Scissors

s. f, ;, s. , , w, , . y3w .

+2

- look-behind... !

y/\(Louis\)\@<=

, , .

+1

All Articles