Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# mouse clickiness
set -g mouse on
# new leader sequence: ctrl+space
set -g prefix C-Space
bind r source-file ~/.tmux.conf
# holding ctrl and hitting space twice will toggle to the previous window
bind-key C-Space last-window
# uncomment if you want window numbers to start at 1 rather than 0
#set -g base-index 1
set-option -ga terminal-overrides ",xterm-256color:Tc"
# New windows inherit current working directory
bind-key c new-window -c '#{pane_current_path}'
bind-key '"' split-window -c '#{pane_current_path}'
bind-key % split-window -h -c '#{pane_current_path}'
bind-key - split-window -c '#{pane_current_path}'
bind-key | split-window -h -c '#{pane_current_path}'
# synchronise shortcut
bind-key s setw synchronize-panes
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-style bg=colour235,fg=colour136 #colour235 -> base02, colour136 -> yellow
# default window title colors
set-window-option -g window-status-style fg=colour244,bg=default,dim #colour244 -> base0
# active window title colors
set-window-option -g window-status-current-style fg=colour166,bg=white,bright # colour166 -> orange
# Status and Bell
set -g status-justify centre # center align window list
set -g status-left-length 70
set -g status-right-length 70
set -g status-justify centre
set -g status-bg colour234
set -g status-left '#[default]┃ #[fg=green,bright]#h #[default]┃ #[fg=blue]#S #I:#P #[default]┃ '
set -g status-right '#[default]┃ #[fg=red,dim]up #(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[default]┃ #[fg=white]%l:%M:%S %p #[default]┃ #[fg=blue]%a %Y-%m-%d #[default]┃'
# Smart pane switching with awareness of Vim splits.
# means that you can use opt+arrow to move across tmux splits and 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 M-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n M-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n M-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n M-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n M-Left if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n M-Down if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n M-Up if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n M-Right if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n M-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\\ select-pane -l
# Also allow ctrl for vim-tmux integration
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
set -sg escape-time 0
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'christoomey/vim-tmux-navigator'
run '~/.tmux/plugins/tpm/tpm'
# ctrl+arrows lets you move across windows
bind-key -n C-Up set-option -g status
bind-key -n C-Down set-option -g status
bind-key -n C-Right next-window
bind-key -n C-Left previous-window
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment