Skip to content

Instantly share code, notes, and snippets.

@lightscalar
Last active July 21, 2018 14:11
Show Gist options
  • Save lightscalar/31d0c2d93f4fa541fcc7403074149dcf to your computer and use it in GitHub Desktop.
Save lightscalar/31d0c2d93f4fa541fcc7403074149dcf to your computer and use it in GitHub Desktop.
Basic .tmux.conf file — good for working with vim
set -g status-keys vi
setw -g mode-keys vi
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 | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
bind -r M-h if-shell "$is_vim" "send-keys M-h" "resize-pane -L 10"
bind -r M-l if-shell "$is_vim" "send-keys M-l" "resize-pane -R 10"
bind -r M-k if-shell "$is_vim" "send-keys M-k" "resize-pane -U 5"
bind -r M-j if-shell "$is_vim" "send-keys M-j" "resize-pane -D 5"
set -g status-keys vi
set -g history-limit 10000
# The -r indicates the command can be repeated multiple times (within 500 ms).
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5
bind-key M-j resize-pane -D
bind-key M-k resize-pane -U
bind-key M-h resize-pane -L
bind-key M-l resize-pane -R
#### COLOUR
# default statusbar colors
#set-option -g status-bg colour235 #base02
#set-option -g status-fg colour136 #yellow
set-option -g status-bg '#90CAF9'
set-option -g status-fg black #base02
set-option -g status-attr default
# default window title colors
#set-window-option -g window-status-fg colour244
#set-window-option -g window-status-bg default
set-window-option -g window-status-fg black
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
#set-window-option -g window-status-attr bright
# active window title colors
set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr bright
# pane border
set-option -g pane-border-fg colour235 #base02
#set-option -g pane-border-fg
#set-option -g pane-active-border-fg colour240 #base01
#set-option -g pane-active-border-fg colour249
set-option -g pane-active-border-fg green
# message text
set-option -g message-bg colour235 #base02
set-option -g message-fg colour166 #orange
# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
# clock
set-window-option -g clock-mode-colour colour64 #green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment