Skip to content

Instantly share code, notes, and snippets.

@Callisto13
Last active October 17, 2022 15:08
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 Callisto13/b4cc217ca4f1c2f7f51405d62b941adb to your computer and use it in GitHub Desktop.
Save Callisto13/b4cc217ca4f1c2f7f51405d62b941adb to your computer and use it in GitHub Desktop.
# Little bits
set -g mouse on
set -g prefix C-Space
bind r source-file ~/.tmux.conf
bind-key C-Space last-window
set -g base-index 0
# linux only
# set-option -ga terminal-overrides ",xterm-256color:Tc"
# New terminals 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}'
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=magenta,dim]up #(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[default]┃ '
set -g status-right '#[default]┃ #[fg=white]%H:%M:%S #[default]┃ #[fg=cyan]%a %d-%m-%Y #[default]┃'
# 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 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'
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