Skip to content

Instantly share code, notes, and snippets.

@frekw
Created January 2, 2019 23:42
Show Gist options
  • Save frekw/381a781ec50783f162fbd1671c43ee91 to your computer and use it in GitHub Desktop.
Save frekw/381a781ec50783f162fbd1671c43ee91 to your computer and use it in GitHub Desktop.
# vi-like navigation setw -g mode-keys vi
# mouse control for panes
set -g mouse on
# don't rename windows automagically
set-option -g allow-rename off
# start windows numbering at 1 and rename on window close
setw -g pane-base-index 1
set -g base-index 1
set -g renumber-windows on
# focus events for vim etc, https://github.com/tmux-plugins/vim-tmux-focus-events
set -g focus-events on
#################################################################################
# BINDINGS
#################################################################################
# Saner prefix; C-b -> C-a
unbind C-b
set -g prefix C-a
bind-key C-a send-prefix
bind-key r refresh-client
# saner vim/emacs splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-l) || tmux select-pane -R"
# ctrl+] => cmd+k (iTerm, send keys: cmd+k => 0x1d)
bind -n C-] send-keys -R \; send-keys C-l \; clear-history
bind-key -Tcopy-mode-vi v send -X begin-selection
bind-key -Tcopy-mode-vi y send -X copy-pipe "reattach-to-user-namespace pbcopy"
unbind -Tcopy-mode-vi Enter
bind-key -Tcopy-mode-vi Enter send -X copy-pipe "reattach-to-user-namespace pbcopy"
# plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'arcticicestudio/nord-tmux'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment