Skip to content

Instantly share code, notes, and snippets.

@pwang2
Last active August 9, 2024 17:59
Show Gist options
  • Save pwang2/e177f57f2bb4a28ed9c4ffd9c37a8edb to your computer and use it in GitHub Desktop.
Save pwang2/e177f57f2bb4a28ed9c4ffd9c37a8edb to your computer and use it in GitHub Desktop.
.tmux.conf
setw -g mode-keys vi
setw -g base-index 1
setw -g pane-base-index 1
setw -g aggressive-resize off
set -g status on
set -g status-position top
set -g escape-time 0
set -g prefix C-a
set -g focus-events on
set -g mouse on
set -g renumber-windows on
set -s set-clipboard on
set -g update-environment "SSH_AUTH_SOCK SSH_CLIENT SSH_CONNECTION DISPLAY"
set -g default-terminal 'tmux-256color'
set-option -a terminal-features 'xterm-256color:RGB'
# set -g terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
# set -as terminal-overrides ',xterm-256color:RGB'
# undercurl support
# set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# underscore colours - needs tmux-3.0
# set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
set -g @continuum-restore 'on'
set -g @tmux-weather-location "Chicago"
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
unbind x; bind x kill-pane
unbind r; bind r source-file ~/.tmux.conf\; display "config reloaded!"
unbind K; bind K send-keys -R\; clear-history\; send-keys Enter\;
unbind m; bind m set status\;
unbind '"'
unbind %
unbind c
bind a setw synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c command-prompt -p "window name: " "new-window -c \"#{pane_current_path}\" -n '%%'"
bind -r k resize-pane -U 5
bind -r j resize-pane -D 5
bind -r h resize-pane -L 5
bind -r l resize-pane -R 5
bind -nr C-S-Left swap-window -t -1\; previous-window
bind -nr C-S-Right swap-window -t +1\; next-window
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_osx="uname | grep -q Darwin"
if-shell "$is_osx" "set-option -as terminal-features \",alacritty:RGB\"" "set-option -as terminal-features \",tmux-256color:RGB\""
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -T copy-mode-vi C-h select-pane -L
bind -T copy-mode-vi C-j select-pane -D
bind -T copy-mode-vi C-k select-pane -U
bind -T copy-mode-vi C-l select-pane -R
bind -T copy-mode-vi v send-keys -X begin-selection
# comment out as now mainly using neovim's smartyank plugin for copy
# bind -T copy-mode-vi y if-shell "$is_osx" "send-keys -X copy-pipe-and-cancel 'pbcopy'" "send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i'"
bind -T copy-mode-vi r send-keys -X rectangle-toggle
if-shell "test -f ~/.tmuxline.conf" "source ~/.tmuxline.conf"
if-shell "test -f ~/.tmux-plugins/tmux-yank/yank.tmux" "run-shell ~/.tmux-plugins/tmux-yank/yank.tmux"
if-shell "test -f ~/.tmux-plugins/tmux-resurrect/resurrect.tmux" "run-shell ~/.tmux-plugins/tmux-resurrect/resurrect.tmux"
if-shell "test -f ~/.tmux-plugins/tmux-continuum/continuum.tmux" "run-shell ~/.tmux-plugins/tmux-continuum/continuum.tmux"
if-shell "test -f ~/.tmux-plugins/tmux-weather/tmux-weather.tmux" "run-shell ~/.tmux-plugins/tmux-weather/tmux-weather.tmux"
if-shell "test -f ~/.tmux-plugins/tmux-temp/temp.tmux" "run-shell ~/.tmux-plugins/tmux-temp/temp.tmux"
#GistID: e177f57f2bb4a28ed9c4ffd9c37a8edb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment