|
|
|
@ -4,6 +4,7 @@ bind r source-file ~/.tmux.conf
|
|
|
|
unbind C-b
|
|
|
|
unbind C-b
|
|
|
|
set -g prefix C-s
|
|
|
|
set -g prefix C-s
|
|
|
|
bind C-s send-prefix
|
|
|
|
bind C-s send-prefix
|
|
|
|
|
|
|
|
bind C-w send-keys C-w
|
|
|
|
|
|
|
|
|
|
|
|
set -g mouse on
|
|
|
|
set -g mouse on
|
|
|
|
|
|
|
|
|
|
|
|
@ -17,6 +18,8 @@ set -g pane-base-index 1
|
|
|
|
# Renumber windows when a window is closed
|
|
|
|
# Renumber windows when a window is closed
|
|
|
|
set -g renumber-windows on
|
|
|
|
set -g renumber-windows on
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set -g set-clipboard on
|
|
|
|
|
|
|
|
|
|
|
|
# Status Line
|
|
|
|
# Status Line
|
|
|
|
set-option -g status-position top
|
|
|
|
set-option -g status-position top
|
|
|
|
set -g status-bg black
|
|
|
|
set -g status-bg black
|
|
|
|
@ -27,45 +30,64 @@ set -g pane-border-style fg=brightblack
|
|
|
|
set -g pane-active-border-style fg=yellow
|
|
|
|
set -g pane-active-border-style fg=yellow
|
|
|
|
set -g message-style bg=yellow,fg=black,bold
|
|
|
|
set -g message-style bg=yellow,fg=black,bold
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Background color logic
|
|
|
|
|
|
|
|
bg_color="#{?#{==:#{client_key_table},VIMLIKE},brightmagenta,#{?client_prefix,brightblue,yellow}}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Text logic
|
|
|
|
|
|
|
|
status_text="#{?#{==:#{client_key_table},VIMLIKE}, WINDOW,#{?client_prefix, PREFIX, NORMAL}}"
|
|
|
|
|
|
|
|
|
|
|
|
# Left side - yellow section with session, transition to gray
|
|
|
|
# Left side - yellow section with session, transition to gray
|
|
|
|
set -g status-left "#[fg=black,bg=brightblue,bold]#{?client_prefix, PREFIX,#[fg=black,bg=yellow,bold] NORMAL} #[fg=black,bg=white] #S "
|
|
|
|
set -g status-left "#[fg=black,bg=${bg_color},bold]${status_text} #[fg=black,bg=white] #S "
|
|
|
|
|
|
|
|
|
|
|
|
# Right side
|
|
|
|
# Right side
|
|
|
|
set -g status-right "#(whoami)@#h #{?client_utf8,| utf-8,} #[fg=black,bg=white] %I:%M %p | %b %d #[fg=black,bg=brightblue]#{?client_prefix,,#[fg=black,bg=yellow,bold]} #I:#P "
|
|
|
|
set -g status-right "#(whoami)@#h #{?client_utf8,| utf-8,} #[fg=black,bg=white] %I:%M %p | %b %d #[fg=black,bg=${bg_color}] #I:#P "
|
|
|
|
|
|
|
|
|
|
|
|
# Window list in the gray middle section
|
|
|
|
# Window list in the gray middle section
|
|
|
|
set -g window-status-format " #I #W "
|
|
|
|
set -g window-status-format " #I #W "
|
|
|
|
set -g window-status-current-format "#[fg=brightblue,bg=black,bold]#{?client_prefix,,#[fg=yellow,bg=black,bold]}[#I #W]"
|
|
|
|
set -g window-status-current-format "#[fg=${bg_color},bg=black,bold][#I #W]"
|
|
|
|
set -g window-status-separator ""
|
|
|
|
set -g window-status-separator ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Smart pane switching with awareness of Vim splits
|
|
|
|
|
|
|
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
|
|
|
|
|
|
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Ctrl-w prefix
|
|
|
|
|
|
|
|
bind -n C-w switch-client -T VIMLIKE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Navigation that works with both tmux and vim
|
|
|
|
|
|
|
|
bind -T VIMLIKE C-h if-shell "$is_vim" 'send-keys C-w C-h' 'select-pane -L'
|
|
|
|
|
|
|
|
bind -T VIMLIKE C-j if-shell "$is_vim" 'send-keys C-w C-j' 'select-pane -D'
|
|
|
|
|
|
|
|
bind -T VIMLIKE C-k if-shell "$is_vim" 'send-keys C-w C-k' 'select-pane -U'
|
|
|
|
|
|
|
|
bind -T VIMLIKE C-l if-shell "$is_vim" 'send-keys C-w C-l' 'select-pane -R'
|
|
|
|
|
|
|
|
bind -T VIMLIKE h if-shell "$is_vim" 'send-keys C-w h' 'select-pane -L'
|
|
|
|
|
|
|
|
bind -T VIMLIKE j if-shell "$is_vim" 'send-keys C-w j' 'select-pane -D'
|
|
|
|
|
|
|
|
bind -T VIMLIKE k if-shell "$is_vim" 'send-keys C-w k' 'select-pane -U'
|
|
|
|
|
|
|
|
bind -T VIMLIKE l if-shell "$is_vim" 'send-keys C-w l' 'select-pane -R'
|
|
|
|
|
|
|
|
bind -T VIMLIKE Left if-shell "$is_vim" 'send-keys C-w Left' 'select-pane -L'
|
|
|
|
|
|
|
|
bind -T VIMLIKE Down if-shell "$is_vim" 'send-keys C-w Down' 'select-pane -D'
|
|
|
|
|
|
|
|
bind -T VIMLIKE Up if-shell "$is_vim" 'send-keys C-w Up' 'select-pane -U'
|
|
|
|
|
|
|
|
bind -T VIMLIKE Right if-shell "$is_vim" 'send-keys C-w Right' 'select-pane -R'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Window management
|
|
|
|
|
|
|
|
bind -T VIMLIKE v if-shell "$is_vim" 'send-keys C-w v' 'split-window -h -c "#{pane_current_path}"' # vertical split
|
|
|
|
|
|
|
|
bind -T VIMLIKE s if-shell "$is_vim" 'send-keys C-w s' 'split-window -v -c "#{pane_current_path}"' # horizontal split
|
|
|
|
|
|
|
|
bind -T VIMLIKE c if-shell "$is_vim" 'send-keys C-w c' 'new-window -c "#{pane_current_path}"' # new window
|
|
|
|
|
|
|
|
bind -T VIMLIKE q if-shell "$is_vim" 'send-keys C-w q' 'kill-pane' # close pane
|
|
|
|
|
|
|
|
bind -T VIMLIKE o if-shell "$is_vim" 'send-keys C-w o' 'kill-pane -a' # only this pane
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Resizing
|
|
|
|
|
|
|
|
bind -T VIMLIKE + if-shell "$is_vim" 'send-keys C-w +' 'resize-pane -U 5'
|
|
|
|
|
|
|
|
bind -T VIMLIKE - if-shell "$is_vim" 'send-keys C-w -' 'resize-pane -D 5'
|
|
|
|
|
|
|
|
bind -T VIMLIKE < if-shell "$is_vim" 'send-keys C-w <' 'resize-pane -L 5'
|
|
|
|
|
|
|
|
bind -T VIMLIKE > if-shell "$is_vim" 'send-keys C-w >' 'resize-pane -R 5'
|
|
|
|
|
|
|
|
bind -T VIMLIKE = if-shell "$is_vim" 'send-keys C-w =' 'select-layout even-horizontal'
|
|
|
|
|
|
|
|
|
|
|
|
# Smart pane switching with awareness of Vim splits.
|
|
|
|
# Movement between windows
|
|
|
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
|
|
|
bind -T VIMLIKE C-w if-shell "$is_vim" 'send-keys C-w C-w' 'last-window' # Ctrl-w Ctrl-w
|
|
|
|
|
|
|
|
bind -T VIMLIKE w if-shell "$is_vim" 'send-keys C-w w' 'last-window' # Ctrl-w w
|
|
|
|
# decide whether we're in a Vim process
|
|
|
|
|
|
|
|
# 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'
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
|
|
|
|
|
|
|
# "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
|
|
|
|
|
|
|
# if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
|
|
|
|
|
|
|
# "bind-key -n 'C-\\' 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# List of plugins
|
|
|
|
# List of plugins
|
|
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
|
|
set -g @plugin 'christoomey/vim-tmux-navigator'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|
|
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|
|
|
run '~/.tmux/plugins/tpm/tpm'
|
|
|
|
run '~/.tmux/plugins/tpm/tpm'
|
|
|
|
|