Dotfiles/site-modules/core/files/tmux.conf

113 lines
4.3 KiB
Bash

# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
# 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)?$|emacs'"
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 -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
#
# Set color term
#
set -g default-terminal "xterm-256color"
set-option -sg escape-time 10
set-option -ga terminal-overrides ",tmux-256color:Tc"
#
# Set long history
#
set-option -g history-limit 5000
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1
# bind : to command-prompt like vim
# this is the default in tmux already
bind : command-prompt
# vi-style controls for copy mode
setw -g mode-keys vi
# set windows so they dont resize to the smallest
setw -g aggressive-resize on
# use mouse on
set -g mouse on
set-option -g mouse on
set -g @open-S 'https://www.duckduckgo.com/'
set -g @open-editor-command 'emacs --no-wait'
# Init plugins
run-shell ~/.tmux/plugins/tmux-copycat/copycat.tmux
run-shell ~/.tmux/plugins/tmux-open/open.tmux
run-shell ~/.tmux/plugins/tmux-yank/yank.tmux
# Automatically renumber window numbers on closing a pane (tmux >= 1.7).
set -g renumber-windows on
# Stay in copy mode on drag end.
# (Would use `bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X
# stop-selection` but it is a bit glitchy.)
unbind-key -T copy-mode-vi MouseDragEnd1Pane
# Search back to last prompt.
bind-key b copy-mode\; send-keys -X start-of-line\; send-keys -X search-backward "⇒"\; send-keys -X next-word
# Set `v` key to start selection like vim
bind-key -T copy-mode-vi 'v' send -X begin-selection
# Start window and pane numbering at 1, (0 is too hard to reach).
set -g base-index 1
set -g pane-base-index 1
# Needed as on tmux 1.9 and up (defaults to off).
# Added in tmux commit c7a121cfc0137c907b7bfb.
# Also need by vim plugin tmux-focus-events.vim
set -g focus-events on
# Github colors for Tmux
#https://github.com/projekt0n/github-theme-contrib/blob/main/tmux/github_light.confhttps://github.com/projekt0n/github-theme-contrib/blob/main/tmux/github_light.confhttps://github.com/projekt0n/github-theme-contrib/blob/main/tmux/github_light.conf
set -g mode-style "fg=#24292f,bg=#f6f8fa"
set -g message-style "fg=#24292f,bg=#f6f8fa"
set -g message-command-style "fg=#24292f,bg=#f6f8fa"
set -g pane-border-style "fg=#e1e4e8"
set -g pane-active-border-style "fg=#0366d6"
set -g status "on"
set -g status-justify "left"
set -g status-style "fg=#0366d6,bg=#f6f8fa"
set -g status-left-length "100"
set -g status-right-length "100"
set -g status-left-style NONE
set -g status-right-style NONE
set -g status-left "#[fg=#f6f8fa,bg=#0366d6,bold] #S #[fg=#0366d6,bg=#f6f8fa,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#f6f8fa,bg=#f6f8fa,nobold,nounderscore,noitalics]#[fg=#f6f8fa,bg=#f6f8fa] #{prefix_highlight} #[fg=#babbbd,bg=#f6f8fa,nobold,nounderscore,noitalics]#[fg=#24292e,bg=#babbbd] %Y-%m-%d  %I:%M %p #[fg=#0366d6,bg=#babbbd,nobold,nounderscore,noitalics]#[fg=#f6f8fa,bg=#0366d6,bold] #h "
setw -g window-status-activity-style "underscore,fg=#586069,bg=#f6f8fa"
setw -g window-status-separator ""
setw -g window-status-style "NONE,fg=#ffffff,bg=#f6f8fa"
setw -g window-status-format "#[fg=#f6f8fa,bg=#f6f8fa,nobold,nounderscore,noitalics]#[fg=#666666,bg=#f6f8fa,nobold,nounderscore,noitalics] #I  #W #F #[fg=#f6f8fa,bg=#f6f8fa,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#f6f8fa,bg=#babbbd,nobold,nounderscore,noitalics]#[fg=#24292e,bg=#babbbd,bold] #I  #W #F #[fg=#babbbd,bg=#f6f8fa,nobold,nounderscore,noitalics]"