Skip to content

Instantly share code, notes, and snippets.

@nZac
Last active December 18, 2020 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nZac/e200b656539b0aa311b579e25c258e36 to your computer and use it in GitHub Desktop.
Save nZac/e200b656539b0aa311b579e25c258e36 to your computer and use it in GitHub Desktop.
.tmux.conf
# curl https://gist.githubusercontent.com/nZac/e200b656539b0aa311b579e25c258e36/raw > ~/.tmux.conf
# Prett Colors! Make sure iTerm2 is setup with "xterm-256color"
set -g default-terminal "screen-256color"
set -g terminal-overrides ""
set -g status-bg '#666666'
set -g status-fg '#aaaaaa'
set-option -g renumber-windows on
set -g update-environment "SSH_AUTH_SOCK"
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
# Remove crud
set -g status-left ''
set -g status-right ''
# Set Ctrl-a as the tmux prefix
unbind C-b
set -g prefix C-a
## Make tmux play nice with Mac OS
# set-option -g default-command "reattach-to-user-namespace -l zsh"
# Sometimes, it is easier to use a mouse... rarely, but sometimes
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft='#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
## Tmux likes to rename things and I say NO!
set -g allow-rename off
## Hurray for better navigation
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
# bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
bind C-a send-prefix
# Setup resizing'
bind -n M-h resize-pane -L 5
bind -n M-j resize-pane -D 5
bind -n M-l resize-pane -R 5
bind -n M-k resize-pane -U 5
# WE lovz vim!
set-window-option -g mode-keys vi
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
# bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -Tcopy-mode-vi Escape send -X cancel
bind-key -Tcopy-mode-vi V send -X rectangle-toggle
# Speed up the use of escape
set -s escape-time 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment