Skip to content

Instantly share code, notes, and snippets.

@chrisshroba chrisshroba/.tmux.conf
Last active Jun 11, 2019

What would you like to do?
# Make it so when you set the window title,
# it is never automatically changed by tmux
set-option -g allow-rename off
# This enables mouse reporting. It lets you:
# - Click on a pane to activate it
# - Right click a pane to `mark` it
# - Drag borders to resize panes
setw -g mouse on
set -g mouse on
# Remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind C-a send-prefix
# Use prefix + | to split the pane into two panes
# vertically, and prefix + - for horizontal, because
# those characters look like the result of the split.
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Unbind the old split-window keys
unbind '"'
unbind %
# Bind Prefix + " to interactive window selection, similar
# to how it works in screen
bind '"' choose-tree -w
# Bind Prefix + r to reload the tmux config on the fly
bind r source-file ~/.tmux.conf
# Switch panes using Ctrl + Arrows with no Prefix
bind -n C-Left select-pane -L
bind -n C-Right select-pane -R
bind -n C-Up select-pane -U
bind -n C-Down select-pane -D
# Resize panes using Ctrl + Shift + Arrows with no Prefix
bind -n C-S-Left resize-pane -L
bind -n C-S-Right resize-pane -R
bind -n C-S-Up resize-pane -U
bind -n C-S-Down resize-pane -D
# Update DISPLAY env variable so that programs that launch
# in X will work (i.e. meld)
set-option -g update-environment "DISPLAY"
# Prefix + s swaps the current pane with the 'marked' pane
# (Prefix + m 'marks' a pane)
bind-key s swap-pane
# Prefix + k kills window with confirmation (just like
# Prefix + &)
bind k confirm-before -p "kill-window #W? (y/n)" kill-window
# Put tmux into vi mode. This makes copy mode use vim-like
# key bindings instead of emacs-like bindings.
set-window-option -g mode-keys vi
# Put the status bar at the top of the window instead of the
# bottom
set-option -g status-position top
set -g base-index 1
set-option -g message-style 'fg=blue'
set-option -g message-command-style 'fg=red'
# Just some coloring I like
set-window-option -g window-style 'fg=default, bg=colour8'
set-window-option -g window-active-style 'fg=default, bg=colour0'
set-window-option -g pane-border-style 'fg=colour8, bg=colour8'
set-window-option -g pane-active-border-style 'fg=colour8, bg=colour8'
# Normally, the tmux config is only read when the tmux *server*
# starts, which happens super infrequently, so this makes every
# new window use the most up-to-date version of the config.
set-hook -g after-new-window 'source ~/.tmux.conf'
# Prompt for a window name every time a new window is created using Ctrl-a c,
# because manual window names are far more descriptive than the
# automatic ones.
##set-hook -g after-new-window "command-prompt -p \"Window name: \" \"rename-window '%%'\""
bind-key c new-window \; command-prompt -p "Window name: " "rename-window '%%'"
#Make it easy to see the current window and pane indices by running `tmux which`
set -s 'command-alias[0]' which='display-message -p "#{window_index}.#{pane_index}"'
# Use powerline status line.
source /usr/share/powerline/bindings/tmux/powerline.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.