dotfiles/.config/tmux/tmux.conf

181 lines
6.3 KiB
Plaintext
Raw Normal View History

2023-12-25 12:57:31 +01:00
# remap prefix to Control + Space
set -g prefix C-Space
bind C-Space last-window
# set -g prefix Escape
# bind Escape send-keys Escape
# bind "'" last-window
unbind C-b
set-option -g allow-passthrough on
# 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 } { if-shell -F '#{pane_at_left}' {} { select-pane -L } }
bind-key -n 'C-j' if-shell "$is_vim" { send-keys C-j } { if-shell -F '#{pane_at_bottom}' {} { select-pane -D } }
bind-key -n 'C-k' if-shell "$is_vim" { send-keys C-k } { if-shell -F '#{pane_at_top}' {} { select-pane -U } }
bind-key -n 'C-l' if-shell "$is_vim" { send-keys C-l } { if-shell -F '#{pane_at_right}' {} { select-pane -R } }
bind-key -T copy-mode-vi 'C-h' if-shell -F '#{pane_at_left}' {} { select-pane -L }
bind-key -T copy-mode-vi 'C-j' if-shell -F '#{pane_at_bottom}' {} { select-pane -D }
bind-key -T copy-mode-vi 'C-k' if-shell -F '#{pane_at_top}' {} { select-pane -U }
bind-key -T copy-mode-vi 'C-l' if-shell -F '#{pane_at_right}' {} { 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 -n C-] copy-mode
bind-key -n 'C-M-c' copy-mode
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
2023-12-27 08:58:32 +01:00
bind-key -T copy-mode-vi 'C-l' select-pane -R
2023-12-25 12:57:31 +01:00
# vim like copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
setw -g mode-keys vi
# Mouse support - set to on if you want to use the mouse
setw -g mouse on
bind -r C-n next-window
bind -r C-p previous-window
# source the .tmux.conf file with prefix + r
bind r source-file ~/.config/tmux/tmux.conf \; display "Configuration Reloaded!"
bind-key - split-window -v
bind-key '\' split-window -h
bind-key _ split-window -fv
bind-key | split-window -fh
bind -r h resize-pane -L 5
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
# set -g lock-after-time 300
# set -g lock-command "asciiquarium"
# bind-key "'" choose-window
# bind-key '"' choose-session
# kill current pane/window
bind-key q kill-pane
bind-key w kill-window
# bind-key Q confirm-before kill-window
# bind-key -n C-q confirm-before kill-pane
# bind-key -n C-w confirm-before kill-window
# undercurl support for tmux
set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
# reorder windows
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
bind-key -n C-Up swap-pane -s '{up-of}'
bind-key -n C-Down swap-pane -s '{down-of}'
bind-key -n C-Left swap-pane -s '{left-of}'
bind-key -n C-Right swap-pane -s '{right-of}'
# set -g default-terminal "xterm-256color"
# tell Tmux that outside terminal supports true color
# set -ga terminal-overrides ",xterm-256color*:Tc"
# start session number from 1 rather than 0
# set -g base-index 1
# start pane number from 1 similar to windows
# setw -g pane-base-index 1
# highlight active pane
# set -g window-style 'fg=colour247,bg=colour236'
# set -g window-active-style 'fg=colour250,bg=black'
# set-option -g pane-active-border-style fg=red
# use <prefix> C-l to clear screen
bind C-l send-keys 'C-l'
# use <prefix> Enter for zooming the current pane
bind-key Enter if-shell "$is_vim" {
resize-pane -Z
# send-keys C-w =
} {
resize-pane -Z
}
# use <prefix> C-j for join pane
bind-key C-j join-pane
# status bar theme
# set -g status 'on'
set-option -g status-position bottom
source-file ~/.config/tmux/dark.conf
set -g status-interval 1
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
# Plugin Customizations
set -g @prefix_highlight_output_prefix "#[fg=#e0af68]#[bg=#16161e]#[fg=#16161e]#[bg=#e0af68]"
set -g @prefix_highlight_output_suffix ""
set -g @prefix_highlight_fg 'colour0'
set -g @prefix_highlight_bg 'colour37'
set -g @prefix_highlight_sync_mode_attr 'fg=colour0,bg=colour36'
set -g @prefix_highlight_copy_mode_attr 'fg=colour0,bg=colour33'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_prompt 'SYNC'
set -g @resurrect-strategy-vim 'session'
set -g @batt_icon_status_charging '⚡'
set -g @yank_selection_mouse 'clipboard' # or 'primary' or 'secondary'
set -g @yank_action 'copy-pipe' # or 'copy-pipe-and-cancel' for the default
set -g @copycat_hash_search 'C-h'
set -g @copycat_ip_search 'M-i'
set -g @copytk-copy-command "xsel --clipboard"
set -g @menus_trigger 't'
# set -g @pomodoro_start 'a' # Start a Pomodoro with tmux-prefix + p
# set -g @pomodoro_cancel 'A' # Cancel a Pomodoro with tmux-prefix key + P
# set -g @pomodoro_on " #[fg=$text_red]🍅 " # The formatted output when the pomodoro is running
# set -g @pomodoro_complete " #[fg=$text_green]🍅 " # The formatted output when the break is running
# set -g @continuum-boot 'on'
# set -g @continuum-restore 'on'
set -g @resurrect-save 'i'
set -g @resurrect-restore 'R'
set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-yank'
# set -g @plugin 'tmux-plugins/tmux-copycat'
# set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# set -g @plugin 'tmux-plugins/tmux-battery'
# set -g @plugin 'tmux-plugins/tmux-cowboy'
# set -g @plugin 'jaclu/tmux-menus'
# set -g @plugin 'laktak/extrakto'
# set -g @plugin 'CrispyConductor/tmux-copy-toolkit'
# set -g @plugin 'olimorris/tmux-pomodoro-plus'
run '~/.config/tmux/plugins/tpm/tpm'