Vertically
select-layout even-vertical
Usually assigned to: Ctrl+b, Alt+2
Horizontally
select-layout even-horizontal
Usually assigned to: Ctrl+b, Alt+1
I believe you can achieve what you're after by:
1) entering copy mode (prefix [)
2) selecting some text (most likely v(isual select)/y(ank))
3) sending it to another pane via tmux paste-buffer -t [left/right]
Here's a proof of concept I just sketched out:
Given a Ruby script called foo.rb in your current directory:
# foo.rb
x = "hello there"
puts x
... and two panes, vertically split (bash in left/irb session in right), if you run cat foo.rb
, enter copy-mode, yank the file's contents and then run tmux paste-buffer -t right
from the left pane, you should see the following output in the right pane:
λ irb
2.5.1 :001 > x = "hello there"
=> "hello there"
2.5.1 :002 > puts x
hello there
=> nil
From there, you could write a shell script and/or wire up a key binding to prevent you from having to type out/recall tmux paste-buffer -t [left/right]
.
paste-buffer
should also handle "ending with enter" for you. From the tmux man page's paste-buffer
entry:
When output, any linefeed (LF) characters in the paste buffer are replaced with a separator, by default carriage return (CR).
If the default separator doesn't work for some reason, you can also specify one using paste-buffer -s ...
.
Best Answer
See this answer (last point in particular). Basically,
tmux
has to do a lot more cursor movement and other extra work to emulate a reduced-width terminal than it would have to do to emulate a reduced height terminal. With a full-width terminal, tmux can just let the terminal emulator it is running in handle the line wrapping, while it has to do its own line wrapping to emulate a reduced-width terminal for side-by-side panes. Each cursor movement involves outputting several bytes (possibly 7 or 8 bytes or more) of escape sequences to tell tmux's controlling terminal to move the cursor, and when lines of text are being rapidly output to the screen and scrolled around, this can add up to a perceptible difference.