Skip to content

Instantly share code, notes, and snippets.

@pavanjadhaw
Created May 16, 2018 14:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavanjadhaw/2cdf8536e8382273bee43fa14ae849cf to your computer and use it in GitHub Desktop.
Save pavanjadhaw/2cdf8536e8382273bee43fa14ae849cf to your computer and use it in GitHub Desktop.
# Default terminal
set-option -g default-terminal "screen-256color"
# Use vim key bindings
set-option -g mode-keys vi
set-option -g status-keys vi
# Turn the mouse on
set-option -g mouse on
# Time in milliseconds for which tmux waits after an escape
set-option -g escape-time 0
# Enable supported focus events
set-option -g focus-events on
# History settings
set-option -g history-limit 10000
set-option -g history-file ~/.tmux/tmuxhistory
# Activity
set-option -g monitor-activity on
set-option -g visual-activity off
# Start window index at 1
set-option -g base-index 1
# Start pane index at 1
set-option -g pane-base-index 1
# Rename window to reflect current program
set-window-option -g automatic-rename on
# Renumber windows when one is closed
set-option -g renumber-windows on
# No bells at all
set-option -g bell-action none
# Enable RGB color if running in xterm
set-option -g -a terminal-overrides ",xterm-256color:Tc"
# Unbind default prefix key
unbind-key C-b
# Set default prefix key
set-option -g prefix C-a
# Bind "C-a C-a" to send "C-a"
bind-key C-a send-prefix
# Reload configuration
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# Switch panes
bind-key -n M-h select-pane -L
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-l select-pane -R
# Switch windows
unbind-key n
bind-key -n M-p previous-window
bind-key -n M-n next-window
bind-key -n M-1 select-window -t:1
bind-key -n M-2 select-window -t:2
bind-key -n M-3 select-window -t:3
bind-key -n M-4 select-window -t:4
bind-key -n M-5 select-window -t:5
bind-key -n M-6 select-window -t:6
bind-key -n M-7 select-window -t:7
bind-key -n M-8 select-window -t:8
bind-key -n M-9 select-window -t:9
bind-key -n M-0 select-window -t:10
# Split pane with same directory
unbind-key '"'
unbind-key %
bind-key - split-window -v -c "#{pane_current_path}"
bind-key \ split-window -h -c "#{pane_current_path}"
bind-key _ split-window -fv -c "#{pane_current_path}"
bind-key | split-window -fh -c "#{pane_current_path}"
# Resize panes
bind-key -n M-H resize-pane -L 2
bind-key -n M-J resize-pane -D 1
bind-key -n M-K resize-pane -U 1
bind-key -n M-L resize-pane -R 2
# Toggle zoom
bind-key -n M-z resize-pane -Z
# Move panes
unbind-key {
unbind-key }
bind-key -r H swap-pane -U
bind-key -r L swap-pane -D
# Kill pane
bind-key x kill-pane
# Swap windows across themselves
bind-key -r "<" swap-window -t -1
bind-key -r ">" swap-window -t +1
# Kill window
unbind-key &
bind-key X kill-window
# Enter copy mode
bind-key -n M-v copy-mode
# Select
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
# Copy
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Cancel
bind-key -T copy-mode-vi Escape send-keys -X cancel
# Paste
bind-key p paste-buffer -s ""
bind-key P choose-buffer "paste-buffer -b '%%' -s ''"
# Make mouse drag end behavior configurable
unbind-key -T copy-mode-vi MouseDragEnd1Pane
bind-key -T copy-mode-vi WheelUpPane select-pane \; send-keys -t{mouse} -X clear-selection \; send-keys -t{mouse} -X -N 5 scroll-up
bind-key -T copy-mode-vi WheelDownPane select-pane \; send-keys -t{mouse} -X clear-selection \; send-keys -t{mouse} -X -N 5 scroll-down
# Jump search mode with prefix
bind-key / copy-mode \; send-keys "/"
bind-key ? copy-mode \; send-keys "?"
# Mode
set-option -g mode-bg brightblack
set-option -g mode-fg default
# Status position
set-option -g status-position top
# Status update interval
set-option -g status-interval 5
# Basic status bar colors
set-option -g status-bg default
set-option -g status-fg white
# Left side of status bar
set-option -g status-left-length 40
set-option -g status-left "#[fg=colour18,bg=colour12] #S #[fg=default,bg=default] "
# Window status
set-option -g window-status-format "#[fg=colour18,bg=brightblack] #I #[fg=white,bg=black] #W "
set-option -g window-status-current-format "#[fg=colour18,bg=colour7] #I #[fg=colour18,bg=colour4] #W "
set-option -g window-status-separator " "
set-option -g status-justify left
# Right side of status bar
set-option -g status-right-length 40
set-option -g status-right " #[fg=brightwhite,bg=black] %a, %d %b %H:%M #[fg=colour18,bg=colour4] #(whoami)@#h "
# Pane border
set-option -g pane-border-bg default
set-option -g pane-border-fg brightblack
set-option -g pane-active-border-bg default
set-option -g pane-active-border-fg white
# Pane number indicator
set-option -g display-panes-colour brightblack
set-option -g display-panes-active-colour brightwhite
# Clock mode
set-option -g clock-mode-colour white
set-option -g clock-mode-style 24
# Message
set-option -g message-bg default
set-option -g message-fg default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment