# # Save this to $HOME/.tmux.conf # # ======== # Tutorial # ======== # this config sets PREFIX to ctrl+a (By default, ctrl-b is the PREFIX) # HELP: PREFIX ? # # Navigation # ---------- # to add a new window: PREFIX c # to switch to previous windows: PREFIX ctrl+a # to switch to exact window: PREFIX N (where N=1-9) # to add a horizontal pane in the current window: PREFIX " # to add a vertical pane in the current window: PREFIX % # pane navigation: PREFIX ctrl+arrow (or just PREFIX arrow) # pane resize: PREFIX alt-arrow # to maximize the current pane: PREFIX z (then same again to undo it) # to get a nice list of all windows: PREFIX w # # Copy/Paste # ---------- # to copy in Putty: hold shift (alt on Mac), then mouse-drag # to paste in Putty: hold shift (alt on Mac), then mouse right-click # to copy / paste in iTerm2: hold alt, then mouse drag / mouse click # if you see q's and x's for lines when using PuTTY, enable this setting: # Window -> Translation -> Enable VT100 line drawing even in UTF-8 mode # # Session # ------- # to list sessions: tmux ls # to dettach the session: PREFIX d (to then reattach later, run: tmux attach) # to start tmux with a session-name: tmux new -s MySessName # to rename a session: PREFIX $ # from outside of tmux: tmux rename-session [-t current-name] [new-name] # # Notes # ----- # If horizontal / vertical lines display as letters, then # you may need to place this in your .bashrc: # export TERM=xterm-256color # # Remapping prefix to Ctrl+a unbind C-b set -g prefix C-a # Toggling windows with PREFIX + Ctrl+a bind-key C-a last-window # Jump to beginning of line in Bash bind a send-prefix # allow highlighting in programs such as less # place in .bashrc: export TERM="xterm-256color" # See also: https://superuser.com/a/1212652/51580 set -g default-terminal "xterm-256color" # Scroll History set -g history-limit 50000 # Set ability to capture on start and restore on exit window data when running an application setw -g alternate-screen on # Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access. set -s escape-time 50 # set first window to index 1 (not 0) to map more to the keyboard layout set-option -g renumber-windows on set -g base-index 1 setw -g pane-base-index 1 # show messages for 4 seconds instead set -g display-time 4000 # turn off repeat, this allowing immediate use of arrow keys bind-key Up select-pane -U bind-key Down select-pane -D bind-key Left select-pane -L bind-key Right select-pane -R ###################################################################### # start of mouse settings # for tmux v2.1 or newer, just use this 1 mouse command: set-option -g mouse off # Use PREFIX m to toggle mouse on/off # this works for tmux 3.1 or newer... # bind-key -T prefix m set -g mouse\; display 'Mouse: #{?mouse,ON,OFF}' # # However, this works for both 2.x and 3.1... bind-key -T prefix m run "m=$(tmux show -g mou|grep -q on;echo $?);tmux set -g mou $m;tmux display mouse:\$m" # For tmux v1.8 or older, use these 4 mouse commands below, instead of the v2.1 command above: # Make mouse useful in copy mode #setw -g mode-mouse on # # Allow mouse to select which pane to use #set -g mouse-select-pane on # # Allow mouse dragging to resize panes #set -g mouse-resize-pane on # # Allow mouse to select windows #set -g mouse-select-window on # # end of mouse settings #######################################################################