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".
y/Louis<CR>
Is there a way to copy the search term βLouisβ as well as for the copied string βOliver Louis catβ? Thanks in advance.
Use modifier /e: y/Louis/e<CR>. If you want to repeat the last search pattern, just leave him y//e<CR>.
/e
y/Louis/e<CR>
y//e<CR>
:help search-offset
/ , , . ( :help exclusive)
/
:help exclusive
f t.
f
t
:
yfs , "s" cat Oliver Louis
yfs
, ,
cat Assassins Scissors
s. f, ;, s. , , w, , . y3w .
;
w
y3w
- look-behind... !
y/\(Louis\)\@<=
, , .