Skip to content

Instantly share code, notes, and snippets.

@GhostSquad57
Created September 19, 2017 20:13
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 GhostSquad57/b706d0c21a2623f9f4a9adf03ac18506 to your computer and use it in GitHub Desktop.
Save GhostSquad57/b706d0c21a2623f9f4a9adf03ac18506 to your computer and use it in GitHub Desktop.
My tmux.conf
set -g default-terminal "tmux-256color"
set-window-option -g xterm-keys on
set-option -g renumber-windows on
# use Ctrl-a for sending commands to tmux instead of Ctrl-b
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set -g history-limit 5000
# turn mouse on
set -g mouse on
# enable mouse scrolling
bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
# easy-to-remember split pane commands
# also open splits in the same directory as the window splitting from
bind | split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
unbind '"'
unbind %
# open new windows in the same directory as the current window
bind c new-window -c '#{pane_current_path}'
# X closes window
unbind &
bind X confirm-before -p "kill-window #W? (y/n)" kill-window
# Swap pans with { and }
# -r switch allows continuous pressing
bind -r { swap-pane -U
bind -r } swap-pane -D
setw -g mode-keys vi # use vi-style keybindings
# moving between panes with vim movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes with vim 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
# moving between panes with vim movement keys
# -n switch removes need for ctrl-a
#bind -n M-h select-pane -L
#bind -n M-j select-pane -D
#bind -n M-k select-pane -U
#bind -n M-l select-pane -R
# moving between panes with arrow keys
# -n switch removes need for ctrl-a
bind -n M-Left select-pane -L
bind -n M-Down select-pane -D
bind -n M-Up select-pane -U
bind -n M-Right select-pane -R
# status options
set -g status "on"
set -g set-titles on # enable wm window titles
set -g set-titles-string "tmux:#I [ #W ]" # wm window title string (uses statusbar variables)
set-window-option -g automatic-rename "on" # auto window rename
set -g status-interval 5 # interval for status to refresh
set -g status-justify centre # center align window list
set -g status-left-length 40 # character limit on left status line
set -g status-right-length 140 # character limit on right status line
set -g status-left "#[fg=cyan]$USER@#[fg=yellow]#H"
set -g status-right '%Y-%m-%d %I:%M:%S %p'
set -g status-position bottom # put statuls line on bottom
set -g window-status-format '#[fg=green,dim]#I: #W'
set -g window-status-current-format '#[fg=white,bold] [#I: #W] '
set-window-option -g window-status-current-fg white
set-window-option -g window-status-separator " "
set-option -g status-bg black
set-option -g status-fg green
set -g alternate-screen on
set-window-option -g monitor-activity off
set -g visual-activity off
set-option -g pane-border-fg green
set-option -g pane-active-border-fg green
# set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
set -s escape-time 0 # Allows for faster key repetition
setw -g aggressive-resize off
bind r source-file ~/.tmux.conf
# http://www.codeography.com/2013/06/19/navigating-vim-and-tmux-splits
bind -n M-h run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n M-j run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n M-k run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n M-l run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment