Corey Rothwell
Corey Rothwell

Reputation: 394

Scroll vim window in Tmux copy mode?

Using tmux in copy mode, I cannot get the vim window to scroll. Is this possible? I'm trying to copy a huge chunk of text in vim inside of one tmux window and paste into another. Thanks.

Upvotes: 3

Views: 1236

Answers (2)

Kent
Kent

Reputation: 195029

try if this works for your needs:

function! SetTmuxBuffer() range
    execute "!tmux set-buffer '" .join(getline(a:firstline, a:lastline),"\015")."'"
endfunction

command! -range ToTmux <line1>, <line2> call SetTmuxBuffer()

put above codes in your vimrc or in a vim file and source it. then you can for example send line1-line8 to tmux buffer:

:1,8ToTmux

or visual select, then

:'<,'>ToTmux

go to another tmux window, try pasting the lines in vim.

Upvotes: 1

Aquaplanet
Aquaplanet

Reputation: 583

I know what you ask for and I searched the net to find it as well. It is something that have bothered me as well. This however might help you with your problem:

http://www.vim.org/scripts/script.php?script_id=4488 - a vim plugin. Not as fancy solution as to enter copy mode and scroll within vim instead of the history/scrollback buffer of tmux.

Upvotes: 2

Related Questions