Skip to content

Instantly share code, notes, and snippets.

@zstatmanweil
Created May 11, 2019 17:16
Show Gist options
  • Save zstatmanweil/f87901090be15e721b461a00a1236b29 to your computer and use it in GitHub Desktop.
Save zstatmanweil/f87901090be15e721b461a00a1236b29 to your computer and use it in GitHub Desktop.
activity-action other
assume-paste-time 1
base-index 0
bell-action any
default-command ""
default-shell "/bin/bash"
destroy-unattached off
detach-on-destroy on
display-panes-active-colour red
display-panes-colour blue
display-panes-time 1000
display-time 750
history-limit 2000
key-table "root"
lock-after-time 0
lock-command "lock -np"
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse off
prefix C-b
prefix2 None
renumber-windows off
repeat-time 500
set-titles off
set-titles-string "#S:#I:#W - \"#T\" #{session_alerts}"
silence-action other
status on
status-interval 15
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " \"#{=21:pane_title}\" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
update-environment[0] "DISPLAY"
update-environment[1] "SSH_ASKPASS"
update-environment[2] "SSH_AUTH_SOCK"
update-environment[3] "SSH_AGENT_PID"
update-environment[4] "SSH_CONNECTION"
update-environment[5] "WINDOWID"
update-environment[6] "XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_@"
set -g default-terminal "screen-256color"
set -g mouse on # Resize pane with mouse
set -g mode-keys vi # Vim commands in terminal
bind-key = split-window -c '#{pane_current_path}' # New horizontal pane
bind-key '"' split-window -c '#{pane_current_path}' -h # New vertical pane
### Vim Tmux Navigator
# https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-w if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\ select-pane -l
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -Tcopy-mode-vi v send -X begin-selection
bind-key -Tcopy-mode-vi y send -X copy-selection
bind-key -Tcopy-mode-vi r send -X rectangle-toggle # Copy in a rectangle
## Cheat seet for above
# C-b Esc -> vim mode in terminal
# v r -> select text to copy in a rectangle
# y -> yank to a buffer
# i -> insert mode
# C-b p -> paste
### Cheat Sheet
# General
# tmux new -s <name> # New named session
# tmux attach -t <name> # Attach to an existing session
# tmux kill-session -t <name> # Kill named session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment