Skip to content

Instantly share code, notes, and snippets.

@etiennebatise
Last active April 3, 2017 14:22
Show Gist options
  • Save etiennebatise/36eaac8e1a70e923071d2e231fc8eef3 to your computer and use it in GitHub Desktop.
Save etiennebatise/36eaac8e1a70e923071d2e231fc8eef3 to your computer and use it in GitHub Desktop.
# Use C-a instead of C-b as the prefix
set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
# Set 256 colors
set -g default-terminal "xterm-256color-italic"
# set -g default-terminal "xterm-256color"
# set default shell
set -g default-command "exec /bin/zsh"
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
set -g display-time 2000
# automatically renumber tmux windows
set -g renumber-windows on
# set vi style key binding
set -g status-keys vi
setw -g mode-keys vi
# be more responsive, changing the default delay
set -sg escape-time 1
# set scrollback
set -g history-limit 10000
# Start numbering at 1
set -g base-index 1
setw -g pane-base-index 1
# automatic window renaming
set-window-option -g automatic-rename on
# aggresive resize
setw -g aggressive-resize on
# tile all windows
unbind =
bind = select-layout tiled
# set colors
set -g status-bg colour15
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
set -g message-attr bold
# Custom status bar
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-bg colour0
setw -g window-status-current-fg colour11
setw -g window-status-current-attr dim
setw -g window-status-bg green
setw -g window-status-fg black
setw -g window-status-attr reverse
set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-fg colour81
setw -g window-status-current-bg colour238
setw -g window-status-current-attr bold
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-fg colour138
setw -g window-status-bg colour235
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
# Powerline symbols:    
# set -g status-left-length 32
# set -g status-right-length 150
# set -g status-interval 2
# set -g status-left '#[fg=colour15,bg=colour4,bold] #S #[fg=colour4,bg=colour7,nobold]'
# set -g status-right ' %R #[fg=colour7,bg=colour15,nobold]#[fg=colour16,bg=colour7,nobold] %d %b #[fg=colour4,bg=colour7,nobold]#[fg=colour15,bg=colour4,bold] #h'
# set -g window-status-format "#[fg=colour16,bg=colour15] #I #W "
# set -g window-status-current-format "#[fg=colour16,bg=colour7,noreverse,bold] #I #[fg=colour7,bg=colour15,nobold] #[fg=colour16,bg=colour15,nobold] #W #F"
# enable mouse support for switching panes/windows
setw -g mouse on
# Saner splitting.
bind v split-window -h
bind s split-window -v
bind S choose-session
# Pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# Pane movement shortcuts
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
# bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
# bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
# bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
# quickly open a new window
bind N new-window
# set vi mode for copy mode
setw -g mode-keys vi
# more settings to make copy-mode more vim-like
unbind [
bind Escape copy-mode
# unbind p
bind P paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-pipe 'xclip -in -selection clipboard'
# bind -t vi-copy 'y' copy-selection
# synchronize all panes in a window
bind y setw synchronize-panes
# maximizing and restoring windows
#unbind Up
#bind Up new-window -d -n fullscreen \; swap-pane -s fullscreen.1 \; select-window -t fullscreen
#unbind Down
#bind Down last-window \; swap-pane -s fullscreen.1 \; kill-window -t fullscreen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment