vivimvim-macros

VI(M), search in two files and scroll to result in two files automatically


I have been doing these operation and require to do it often.

step 1. Search for a string (SHFT + *)
step 2. Switch to previous view port (CTRL + w + h)
step 3. Find the string ( n )
step 4. Return to the other view port (CTRL + w + l)

With Vi(m), is it possible to automate above 4 steps in one go?

I searched the net and stackoverflow, I am NOT talking about :set scrollbind.


Solution

  • The answer and the clue by IngoKarkat about mapping lead to this
    :nnoremap <F3> <S-*><C-w>hn<C-w>l
    and this work like a charm.

    Function key F3 is key mapping.