My colleague created some bash functions to assist with finding a live agent: https://github.com/wwalker/ssh-find-agent
He uses it mainly for connecting between systems (laptop to desktop, etc), but I use it most often for local tmux sessions where you logout/in from your window manager (OS X for myself).
Usage
Download ssh-find-agent.bash (git clone git://github.com/wwalker/ssh-find-agent.git
works).
Add the following to ~/.bashrc:
. /path/to/ssh-find-agent.bash
Then you can type the following to set SSH_AUTH_SOCK in your current shell:
set_ssh_agent_socket
Make sure to check the bottom of this post for necessary bindings that need to go into your .tmux.conf file.
I am assuming your prefix key is C-a:
- C-a means: press Ctrl + A
- C-a [ means: press Ctrl + A then press [
To do a rectangle selection of text from (1,1) to (2,2) in tmux:
- Go to the copy mode: C-a [
- Move the middle of a line
- Press C-v
- Press Space
- Move the selection with jkhl
- Once you are happy with your selection press Enter (or y if you have
the binding in your conf file).
- You can paste the latest copy buffer by: C-a ]
Notice that pressing space is necessary for rectangle selection.
To select lines like you would normally do, go the copy mode, and press v, select with jkhl keys and press y.
I have these bindings in my .tmux.conf:
Prior to version 2.4 (20 April 2017):
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection # Begin selection in copy mode.
bind-key -t vi-copy 'C-v' rectangle-toggle # Begin selection in copy mode.
bind-key -t vi-copy 'y' copy-selection # Yank selection in copy mode.
After version 2.4:
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode.
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode.
bind-key -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode.
It is important to unbind default rectangle-toggle binding:
unbind-key -t vi-copy v # Prior to version 2.4
unbind-key -T copy-mode-vi v
Otherwise new 'C-v' binding doesn't work.
Note: to have a single .tmux.conf
which works across versions, see this question.
Best Answer
tmux windows are limited to the size of the smallest client viewing any session they are linked to (that is, the window is part of).
This can be changed slightly with the
aggressive-resize
window option which constrains them to the size of the smallest client actually displaying that window.To get the window back to full size, the best bet is to detach any other clients using that window. Use C-b D to select the clients individually or C-b:
attach -d
to detach all others on that session.