dotfiles/.config/tmux/tmux.conf

180 lines
6.9 KiB
Plaintext
Raw Normal View History

2021-04-25 15:15:26 +02: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 }
}
bind-key -n 'C-j' if-shell "$is_vim" { send-keys C-j } { if -F '#{pane_at_bottom}' { } { select-pane -D }
}
bind-key -n 'C-k' if-shell "$is_vim" { send-keys C-k } { if -F '#{pane_at_top}' { } { select-pane -U }
}
bind-key -n 'C-l' if-shell "$is_vim" { send-keys C-l } { if -F '#{pane_at_right}' { } { select-pane -R } }
2021-04-25 15:15:26 +02:00
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'"
2022-01-25 15:00:57 +01:00
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'
2021-04-25 15:15:26 +02:00
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
2022-01-25 15:00:57 +01:00
2021-04-25 15:15:26 +02:00
# source the .tmux.conf file with prefix + r
2022-04-06 20:58:07 +02:00
bind r source-file ~/.config/tmux/tmux.conf \; display "Configuration Reloaded!"
2021-04-25 15:15:26 +02:00
bind-key - split-window -v
bind-key '\' split-window -h
bind-key _ split-window -fv
bind-key | split-window -fh
# set -g lock-after-time 300
# set -g lock-command "asciiquarium"
# bind-key "'" choose-window
# bind-key '"' choose-session
# kill current pane/window
2021-07-17 15:41:57 +02:00
# bind-key -n q confirm-before kill-pane
# bind-key Q confirm-before kill-window
bind-key -n C-q confirm-before kill-pane
2022-03-18 08:25:20 +01:00
bind-key -n C-w confirm-before kill-window
2021-04-25 15:15:26 +02:00
# no prefix, just c-x
2022-01-25 15:00:57 +01:00
bind C-x setw synchronize-panes
2021-04-25 15:15:26 +02:00
# 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
set -g default-terminal "tmux-256color"
2021-07-17 15:36:56 +02:00
# tell Tmux that outside terminal supports true color
set -ga terminal-overrides ",xterm-256color*:Tc"
2021-04-25 15:15:26 +02:00
# 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'
2022-01-25 15:00:57 +01:00
# use <prefix> Enter for zooming the current pane
bind-key Enter if-shell "$is_vim" {
2021-07-15 15:25:17 +02:00
resize-pane -Z
send-keys C-w =
} {
resize-pane -Z
}
2022-01-25 15:00:57 +01:00
bind-key i run-shell "tmux neww ~/scripts/cheat.sh"
2021-07-15 15:25:17 +02:00
2021-04-25 15:15:26 +02:00
2022-01-25 15:00:57 +01:00
# use <prefix> C-j for join pane
bind-key C-j join-pane
2021-04-25 15:15:26 +02:00
# status bar theme
set -g status 'on'
2022-04-06 20:58:07 +02:00
# set -g status-bg 'colour235'
2021-04-25 15:15:26 +02:00
set -g status-justify 'centre'
set -g status-style 'none'
set -g status-left-style 'none'
set -g status-left-length '100'
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 ''
2022-04-06 20:58:07 +02:00
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] '
2021-04-25 15:15:26 +02:00
# 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]'
2022-04-06 20:58:07 +02:00
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}'
2021-04-25 15:15:26 +02:00
2021-04-29 15:58:21 +02:00
set -g status-interval 1
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
2021-04-25 15:15:26 +02:00
# Plugin Customizations
2021-07-15 15:00:31 +02:00
set -g @prefix_highlight_fg 'colour0'
2022-04-06 20:58:07 +02:00
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'
2021-04-25 15:15:26 +02:00
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 '⚡'
2022-01-25 15:00:57 +01:00
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 'h'
2022-04-06 20:58:07 +02:00
# 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
2021-04-25 15:15:26 +02:00
2021-04-29 15:58:21 +02:00
# set -g @continuum-boot 'on'
# set -g @continuum-restore 'on'
2021-04-25 15:15:26 +02:00
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'
2022-01-25 15:00:57 +01:00
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'
2022-04-06 20:58:07 +02:00
# set -g @plugin 'olimorris/tmux-pomodoro-plus'
run '~/.config/tmux/plugins/tpm/tpm'
2022-01-25 15:00:57 +01:00