vi ~/.tmux.conf
# make tmux display things in 256 colors
set -g default-terminal "xterm-256color"
# set -g default-terminal "screen-256color"
set -g default-shell $SHELL
# set scrollback history to 30000 (30k)
set -g history-limit 30000
# set ` (tic) as the default prefix key combination
# and unbind C-b to free it up
unbind C-b
set -g prefix `
# use send-prefix to pass ` (tic) through to application
bind ` send-prefix
# shorten command delay
# make nvim not pause after hitting escape
set -sg escape-time 0
# set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
# reload ~/.tmux.conf using PREFIX r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# use PREFIX | to split window horizontally and PREFIX - to split vertically
bind | split-window -h
bind - split-window -v
# Rebind split and new-window commands to use current path
#bind '"' split-window -c "#{pane_current_path}"
# Some window splitting shortcuts
# open split-window at the bottom of current pane
bind t split-window -f -l 15 -c "${pane_current_path}"
# open split-window to the right of current pane
bind T split-window -h -f -p 35 -c "${pane_current_path}"
#bind T swap-window -t 1
# map Vi movement keys as pane movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# and use C-h and C-l to cycle thru panes
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes using PREFIX H, J, K, L
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# C-i for even-vertical arrangement and C-o to zoom current pane
bind-key C-i select-layout even-vertical
bind-key C-v select-layout even-horizontal
bind-key C-o resize-pane -y 1000
# Sync panes
bind C-s set-window-option synchronize-panes
# mouse control for tmux v2.1
set -g mouse on
# ---------------------
# Copy & Paste
# ---------------------
# use vi/vim key bindings in copy mode
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi Escape send -X cancel
if-shell "uname | grep -q Darwin" {
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
}
if-shell "uname | grep -q Linux" {
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
}
# setup 'v' to begin selection as in Vim
# bind-key -T copy-mode-vi 'v' send -X begin-selection
# bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel
# bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel
bind-key p paste-buffer
# handle macOS
# if-shell 'test "$(uname)" = "Darwin"' 'source ~/.dotfiles/tmux/tmux-macos.conf'
# Save entire tmux history to a file - file will be on machine where tmux is
# running
bind-key * command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# ----------------------
# set some pretty colors
# ----------------------
# set pane colors - hilight the active pane
set-option -g pane-active-border-style fg=colour33 # blue
# colorize messages in the command line
set-option -g message-style bg=black #base02
set-option -g message-style fg=brightred #orange
# ----------------------
# Status Bar
# -----------------------
set-option -g status on # turn the status bar on
# set -g status-utf8 on # set utf-8 for the status bar
set -g status-interval 5 # set update frequencey (default 15 seconds)
set -g status-justify centre # center window list for clarity
# set-option -g status-position top # position the status bar at top of screen
# visual notification of activity in other windows
setw -g monitor-activity on
set -g visual-activity on
# set color for status bar
# set-option -g status-style bg=colour235
set-option -g status-style bg=colour232
set-option -ga status-style fg=yellow
# set-option -ga status-style dim
# set window list colors - red for active and cyan for inactive
# default window title colors
set-window-option -g window-status-style fg=brightblue
set-window-option -ga window-status-style bg=colour232
set-window-option -ga window-status-style bright
# active window title colors
set-window-option -g window-status-current-style fg=red
set-window-option -ga window-status-current-style bg=colour232
set-window-option -ga window-status-current-style bright
# Status Bar
# left: host, load averages, prefix key indicator
# right: session name, window & pane number, date & time
set -g status-left-length 85
set -g status-left "#[fg=green]: #h : #[fg=brightblue]#(uptime | rev | cut -d ' ' -f 1-3 | rev) #{?client_prefix,#[fg=colour2]^A,} #(tmuxip.sh) "
set -g status-right-length 80
set -g status-right "#[fg=blue]#S #I:#P #[fg=yellow]: %d %b %Y #[fg=green]: %l:%M %p : #(date -u | awk '{print $4}') :"