On 17/03/11 18:26, Jean-Rene David wrote:
I recently started using the :yank, :copy and :move commands (as opposed
to doing the equivalent operations in normal mode).

Now say I have two windows open on distinct files. If my cursor is in
window A, is there any way to :yank a line from window B without having
to move my cursor to window B?

Thanks for any input,


I don't think so, but the following mappings may help you:

    " go to next window (round-robin)
    map <F11> <C-W>w
    imap <F11> <C-O><C-W>w
    " go to previous window (round-robin)
    map <S-F11> <C-W>W
    imap <S-F11> <C-O><C-W>W
    " with count, and in Normal mode only, either of the above goes
    " to nth window from top

Or if you know which lines to yank (let's say as the contents of some variables or the result of some expressions) you could write a function to go to the next window and come back:

        func YankFromNext() range
                wincmd w
                exe a:firstline . ',' . a:lastline . 'y'
                wincmd W
        endfunc

and call that function in any script or mapping needing it.


Best regards,
Tony.
--
"I used to think I was indecisive, but now I'm not so sure."

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to