Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hamsternik/14a3dfe49a42147573b30efd91324235 to your computer and use it in GitHub Desktop.
Save hamsternik/14a3dfe49a42147573b30efd91324235 to your computer and use it in GitHub Desktop.
#{Re-map default prefix: 'C-b' to 'C-a'}
unbind C-b
set -g prefix C-a
bind C-a send-prefix
### Main Options
###########################################################################
#{Scroll History}
set -g history-limit 50000
#{Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.}
set -s escape-time 50
#{Set first window to index 1 (not 0) to map more to the keyboard layout}
set -g renumber-windows on
set -g base-index 1
setw -h pane-base-index 1
#{Mouse scrolling on tmux session}
set -g mouse on
#{Enabling xterm-keys}
set -g xterm-keys on
#{To use a 256 color terminal - setup correct term in tmux}
set -g default-terminal "screen-256color"
#{Fix pbcopy/pbpaste}
if 'command -v reattach-to-user-namespace >/dev/null' \
'set -gq @osx-pasteboard true'
if 'tmux show -gv @osx-clipboard' \
'set -g default-command "reattach-to-user-namespace -l $SHELL"'
# present a menu of URLs to open from the visible pane. sweet.
bind-key u capture-pane \;\
save-buffer /tmp/tmux-buffer \;\
split-window -l 10 "urlview /tmp/tmux-buffer"
### Clipboard
###########################################################################
# TODO: I dont' see any side-effects using this command, so, right now it'll be commented
#set-option -g set-clipboard off
#{ctrl-c to send to clipboard}
#bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
#{ctrl-v to paste from clipboard}
#bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
#{Selection with mouse should copy to clipboard right away, in addition to the default action.}
unbind -n -Tcopy-mode-vi MouseDragEnd1Pane
bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | pbcopy > /dev/null"
#{Drag to re-order windows}
bind-key -n MouseDrag1Status swap-window -t=
### Key-bindings
###########################################################################
#{Quick `source-file` reloading inside tmux session}
bind r source-file ~/.tmux.conf
#{Re-mapped *horizontal* window split & default key unbind}
bind-key -n C-h split-window -h
unbind '"'
#{Re-mapped *vertical* window split & default key unbind}
bind-key -n C-v split-window -v
unbind %
#{Command to toggle mouse scrolling option on tmux session}
bind-key m set-option -g mouse on \; display 'Mouse: ON'
bind-key M set-option -g mouse off \; display 'Mouse: OFF'
### Theme
###########################################################################
#{Update status bar every second, instead of default timeout (15 sec)}
set -g status-interval 1
### { Window Status Formatting }
set -g window-status-format '#I:#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F'
set -g window-status-current-format '#I:#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F'
### Interface
###########################################################################
# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
# modes
setw -g clock-mode-colour colour5
setw -g mode-attr bold
setw -g mode-fg colour1
setw -g mode-bg colour18
# panes
set -g pane-border-bg colour0
set -g pane-border-fg colour19
set -g pane-active-border-bg colour0
set -g pane-active-border-fg colour9
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-bg colour18
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour19,bold] %d/%m #[fg=colour233,bg=colour8,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-fg colour1
setw -g window-status-current-bg colour19
setw -g window-status-current-attr bold
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
setw -g window-status-fg colour9
setw -g window-status-bg colour18
setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1
# messages
set -g message-attr bold
set -g message-fg colour232
set -g message-bg colour16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment