1
0
Files
dotfiles/tmux/.tmux.conf
2025-02-13 20:24:17 +01:00

93 lines
3.5 KiB
Bash

# List of plugins
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 @continuum-boot 'on'
set -g @continuum-boot-options 'iterm,fullscreen'
set -g @plugin 'dracula/tmux'
# set -Fg 'status-format[1]' '#{status-format[0]}'
# set -g 'status-format[0]' ''
# set -g status 2
set -g @dracula-plugins "git weather time battery"
set -g @dracula-show-fahrenheit false
set -g @dracula-fixed-location "Madrid"
set -g @dracula-show-powerline false
set -g @dracula-transparent-powerline-bg true
set -g @dracula-military-time true
set -g @dracula-day-month true
set -g @plugin 'ofirgall/tmux-window-name'
set -g @tmux_window_name_substitute_sets "[('.+bash', 'bash')]"
set -g @tmux_window_name_shells "['bash', 'fish', 'sh', 'zsh']"
set -g @tmux_window_dir_programs "['nvim', 'vim', 'vi', 'git']"
set -g @tmux_window_name_use_tilde "True"
set -g @tmux_window_name_max_name_len "100"
# set-option -g default-shell $SHELL
# set -g default-command "$SHELL -i"
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
bind r source-file ~/.tmux.conf \; display "Reloaded!" # Reload with ctrl-r
set -sg escape-time 1 # quicker responses
set -g base-index 1 # Numbering of windows
setw -g pane-base-index 1 # Numbering of Panes
set -g mouse on
bind-key -n C-t new-window
bind-key -n C-S-T new-window -c '#{pane_current_path}'
bind-key -n C-S-Down next-window
bind-key -n C-S-Up previous-window
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
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
setw -g mode-keys vi
# 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)?$'"
is_vim="~/.is_vim.sh '#{pane_tty}'"
# is_vim="children=(); i=0; pids=( $(ps -o pid=,tty= | grep -iE '#{s|/dev/||:pane_tty}' | awk '\{print $1\}') ); \
# while read -r c p; do [[ -n c && c -ne p && p -ne 0 ]] && children[p]+=\" $\{c\}\"; done <<< \"$(ps -Ao pid=,ppid=)\"; \
# while (( $\{#pids[@]\} > i )); do pid=$\{pids[i++]\}; pids+=( $\{children[pid]-\} ); done; \
# ps -o state=,comm= -p \"$\{pids[@]\}\" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'S-Left' if-shell "$is_vim" 'send-keys S-Left' 'select-pane -L'
bind-key -n 'S-Down' if-shell "$is_vim" 'send-keys S-Down' 'select-pane -D'
bind-key -n 'S-Up' if-shell "$is_vim" 'send-keys S-Up' 'select-pane -U'
bind-key -n 'S-Right' if-shell "$is_vim" 'send-keys S-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-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'
bind-key -T copy-mode-vi 'S-Left' select-pane -L
bind-key -T copy-mode-vi 'S-Down' select-pane -D
bind-key -T copy-mode-vi 'S-Up' select-pane -U
bind-key -T copy-mode-vi 'S-Right' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+
run '~/.tmux/plugins/tpm/tpm'