2 minute read

Collection of simple/handy commands and my .tmux.conf.

.tmux.conf


# global
set-option -g history-limit 10000
set -g prefix M-b
bind '%' split-window -h -c '#{pane_current_path}'
bind '"' split-window -v -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'



# Ensure window index numbers get reordered on delete.
set-option -g renumber-windows on

# Start windows and panes index at 1, not 0.
set -g base-index 1
setw -g pane-base-index 1

# copy paste stuff
set-option -g mouse on

# These bindings are for X Windows only. If you're using a different
# window system you have to replace the `xsel` commands with something
# else. See https://github.com/tmux/tmux/wiki/Clipboard#available-tools
bind -T copy-mode    DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -n DoubleClick1Pane select-pane \; copy-mode -M \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode    TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode-vi TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -n TripleClick1Pane select-pane \; copy-mode -M \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -n MouseDown2Pane run "tmux set-buffer -b primary_selection \"$(xsel -o)\"; tmux paste-buffer -b primary_selection; tmux delete-buffer -b primary_selection"

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @yank_action 'copy-pipe-no-clear'
bind -T copy-mode    C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

Commands


Tmux has three levels of hierarchy when it comes to organizing views: sessions, windows, and panes. Sessions are groups of windows, and a window is a layout of panes.

Sessions:

tmux new -s htb // new session name 'htb'
tmux list-sessions // list sessions
tmux a // attach to last session
tmux a -t htb // attach to session name 'htb'

Windows:

prefix c // new window
prefix , // rename current window
prefix p // previos window
prefix n // next window
prefix & // close current window
prefix [0-9] //switch to window [0-9]

Panes:

prefix % // split pane horizontally
prefix " // split pane verifcally
prefix ! // convert pane to window
prefix [right/left/up/down] // move pane right/left/up/down (keep holding down prefix)
prefix [right/left/up/down] // switch to pane to the right/left/up/down (not holding down prefix)
prefix x // kill current pane

Categories:

Updated: