dotfiles/dot_config/tmux/tmux.conf.tmpl

149 lines
3.8 KiB
Cheetah
Raw Normal View History

2024-01-14 20:23:41 +09:00
# 256 color
{{- if (or (eq .chezmoi.hostname "arch") (eq .chezmoi.hostname "buzz") }}
2024-01-14 20:23:41 +09:00
set -g default-terminal "screen-256color"
{{- else }}
set -g default-terminal "tmux-256color"
{{- end }}
2024-01-14 20:23:41 +09:00
set -ga terminal-overrides ',xterm-256color:RGB'
# increase limit of "scrollback buffer"
set -g history-limit 1000000
# reduce dely
set -sg escape-time 1
# enable mouse
setw -g mouse
# for neovim (adviced when running the :checkhealth command)
set-option -g focus-events on
#################
# keybindings
#################
# Prefix
set-option -g prefix C-t
bind-key t send-prefix
# Reload config
bind r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "Config Reloaded!!"
# Split pane
bind C-l split-window -h -c '#{pane_current_path}'
bind C-j split-window -v -c '#{pane_current_path}'
# Session control
bind C-c new-session
bind C-t run "tmuxsh >/dev/null"
bind 0 run "tmuxsh wiki >/dev/null"
bind 1 run "tmuxsh blog >/dev/null"
bind 3 run "tmuxsh tessoku >/dev/null"
bind 8 run "tmuxsh music >/dev/null"
bind 9 run "tmuxsh util >/dev/null"
# Show pane number (can move to the pane by hit a num while it's displayed)
bind-key C-g display-panes
#########################
# vim-like keybindings
#########################
# select pane
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize pane
bind -r H resize-pane -L 1
bind -r J resize-pane -D 1
bind -r K resize-pane -U 1
bind -r L resize-pane -R 1
# Copy mode
setw -g mode-keys vi
bind-key Escape copy-mode
bind-key -T copy-mode-vi Escape send-keys -X cancel
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"
bind-key p run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
###########################
# Aesthetic
###########################
# pane border
set -g pane-active-border-style fg=yellow
# message/command bar
set -g message-command-style 'fg=#cccccc bg=#333333 bold'
set -g message-style 'fg=#cccccc bg=#333333 bold'
# status bar
set -g status off
set -g status-position bottom
set -g status-bg '#333333'
set -g status-fg '#cccccc'
set -g status-left ''
set -g status-right ''
set -g window-status-format ''
set -g window-status-current-format ''
###############################################
# local and nested remote tmux sessions {{{
# - https://www.freecodecamp.org/news/tmux-in-practice-local-and-nested-remote-tmux-sessions-4f7ba5db8795/
# - https://gist.github.com/samoshkin/05e65f7f1c9b55d3fc7690b59d678734
bind -T root M-q \
set prefix None \;\
set key-table off \;\
set status on \;\
set status-right '#[bold align=centre]DIVING'
bind -T off M-q \
set -u prefix \;\
set -u key-table \;\
set -u status off \;\
set status-right ''
# local and nested remote tmux sessions }}}
###############################################
{{- if (or (eq .chezmoi.hostname "arch") (eq .chezmoi.hostname "buzz") }}
2024-01-14 20:23:41 +09:00
#######################
# Plugins
#######################
## List of plugins
set-environment -g TMUX_PLUGIN_MANAGER_PATH "$XDG_CACHE_HOME/tmux/plugins"
# Tmux Plugin Manager
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @thumbs-contrast 4
set -g @thumbs-bg-color 'black'
set -g @thumbs-fg-color 'yellow'
set -g @thumbs-hint-fg-color 'red'
set -g @thumbs-hint-bg-color 'black'
set -g @thumbs-position 'right'
set -g @thumbs-command 'echo -n {} | xsel -ib'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b "$XDG_CACHE_HOME/tmux/plugins/tpm/tpm"
{{- end }}