dotfiles/.config/tmux/tmux.conf

189 lines
7.2 KiB
Plaintext
Raw Permalink Normal View History

2023-12-25 11:21:57 +01:00
# remap prefix to Control + Space
set -g prefix C-Space
bind C-Space send-prefix
unbind C-b
# 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 -F '#{pane_at_left}' { select-pane -L } { select-pane -L }
}
bind-key -n 'C-j' if-shell "$is_vim" { send-keys C-j } { if -F '#{pane_at_bottom}' { select-pane -D } { select-pane -D }
}
bind-key -n 'C-k' if-shell "$is_vim" { send-keys C-k } { if -F '#{pane_at_top}' { select-pane -U } { select-pane -U }
}
bind-key -n 'C-l' if-shell "$is_vim" { send-keys C-l } { if -F '#{pane_at_right}' { select-pane -R } { 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 C-] copy-mode
bind-key -n C-_ run-shell '/bin/bash ~/scripts/search-notes.sh'
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
# 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
# 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 -n q confirm-before kill-pane
# 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
# no prefix, just c-x
bind C-x setw synchronize-panes
# 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 "tmux-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
}
bind-key i run-shell "tmux neww ~/scripts/cheat.sh"
# use <prefix> C-j for join pane
bind-key C-j join-pane
# status bar theme
set -g status 'on'
# set -g status-bg 'colour235'
set -g status-justify 'centre'
set -g status-style 'none'
set -g status-left-style 'none'
set -g status-left-length '20'
set -g status-right-style 'none'
set -g status-right-length '100'
set -g message-command-style fg='colour222',bg='colour238'
set -g message-style bg='colour238',fg='colour222'
set -g pane-active-border-style fg='colour154'
set -g pane-border-style fg='colour238'
setw -g window-status-style fg='colour121',bg='colour235','none'
setw -g window-status-activity-style bg='colour235',fg='colour154','none'
setw -g window-status-separator ''
set-option -g status-style bg=default
set -g status-left '#[fg=colour232,bg=colour37] #S #[fg=colour37,bg=colour73,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour73] #W #[fg=colour73,bg=default,nobold,nounderscore,noitalics] '
# above status + whoami and uptime
# set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(whoami)  #(uptime | cut -d " " -f 1,2,3) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
setw -g window-status-current-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=default,bg=colour235,bold,underscore]#I  #W  #F#[fg=colour235,bg=default,nobold,nounderscore,noitalics]'
setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour150,bg=default]#I  #W#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
set -g status-right '#[fg=colour235,bg=default,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235]%R  %a  %h-%d #[fg=colour37,bg=colour235,nobold,nounderscore,noitalics] #{prefix_highlight}'
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_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 @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'