Skip to content

Instantly share code, notes, and snippets.

Created January 26, 2018 04:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Tmux: tmux.conf
# set -g default-terminal "screen-256color"
# fix pbpaste and pbcopy commands on OSX
# set-option -g default-command "reattach-to-user-namespace -l $SHELL"
# Report support for 256 colors
set -g default-terminal "screen-256color"
# remap prefix to C-a
set -g prefix C-a
unbind C-b
# Ensure that we can send ctrl-a through to other apps by using it twice
bind C-a send-prefix
# bind vi key-mapping
set-option -g status-keys vi
# vi-style controls for copy mode
set-window-option -g mode-keys vi
# no esc delay, for vim
set -sg escape-time 0
# enable mouse support
set -g mouse off
# large history
set-option -g history-limit 100000
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# color navbar
#set -g status-bg colour235
# set color window borders
set -g pane-border-fg colour148
set -g pane-active-border-fg colour069
# quick pane cycling
# unbind ^A
# bind ^A select-pane -t :.+
# Handle cursor keys per-pane for VIM cursor toggle between modes
set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cs=\E]12;%p1%s\007:Cr=\E]112\007:Ss=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
# Support 24-bit color
set-option -ga terminal-overrides ",xterm-256color:Tc"
# Smart pane switching with awareness of Vim splits.
# See:
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-\ 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
# Make splits default to the current pane's path
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# Start JRoth settings
set -g mouse on
# Set window and pane indexes to start at 1
set -g base-index 1
setw -g pane-base-index 1
# Reload this file with prefix-r
bind r source-file ~/.tmux.conf \; display "tmux.conf reloaded"
# split panes with | and -
bind | split-window -h
bind - split-window -v
# Resize panes 5 rows or columns with capital movement keys
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Set status line style
set -g status-style fg=white,bold,bg=black
# Set colors of window list
setw -g window-status-style fg=cyan,bg=black
setw -g window-status-current-style fg=white,bold,bg=red
# colors for pane borders
setw -g pane-border-style fg=green,bg=black
setw -g pane-active-border-style fg=white,bg=yellow
# Command message line
set -g message-style fg=white,bold,bg=black
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
# Manage buffers like vim
bind Escape copy-mode
# bind -t vi-copy 'v' begin-selection
# bind -t vi-copy 'y' copy-selection
# New way
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
unbind p
bind p paste-buffer
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment