Skip to content

Instantly share code, notes, and snippets.

@Dammic
Last active July 10, 2018 08:19
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 Dammic/e8c02452b29bcf86e29234bd1d20fbf1 to your computer and use it in GitHub Desktop.
Save Dammic/e8c02452b29bcf86e29234bd1d20fbf1 to your computer and use it in GitHub Desktop.
if-shell "test -f ~/.tmux-status.conf" "source ~/.tmux-status.conf"
set -g default-terminal "screen-256color"
# Enables a true-color support in Tmux
set-option -ga terminal-overrides ",xterm-256color:Tc"
# Moving between panes.
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Re-bind last window command
bind b last-window
# Pane resizing.
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
# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
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 -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Vimlike copy mode.
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
# Enable vi keys.
setw -g mode-keys vi
# Setting the delay between prefix and command.
set -sg escape-time 1
# Set the base index for windows to 1 instead of 0.
# set -g base-index 1
# Set the base index for panes to 1 instead of 0.
# setw -g pane-base-index 1
# Enable activity alerts.
setw -g monitor-activity on
set -g visual-activity on
# Pane colors.
set -g pane-border-fg green
# Command / message line.
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# split panes using | and -
bind \ split-window -h
bind - split-window -v
unbind '"'
unbind %
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment