Files
coder-default/env/.tmux.conf
Morten Olsen 273e5c5a11 init
2025-09-09 22:53:17 +02:00

107 lines
3.3 KiB
Bash

set -g mouse on
#set -g default-terminal "screen-256color-bce"
#set -g status-justify centre
#set -ga terminal-overrides ',xterm-256color:Tc'
set -ag terminal-overrides ",xterm-256color:RGB"
set -g base-index 1
set -g renumber-windows on
bind q lock-client
unbind '"'
unbind %
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 10
bind -r L resize-pane -R 10
bind o attach -c "#{pane_current_path}"
# don't rename windows automatically
set-option -g allow-rename off
set -g @plugin 'tmux-plugins/tpm'
run -b '~/.tmux/plugins/tpm/tpm'
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# set -g @plugin "arcticicestudio/nord-tmux"
# set -g @plugin 'dracula/tmux'
# set -g @dracula-show-powerline true
set -g @plugin 'wfxr/tmux-power'
# set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-sensible'
# open pane in vim
bind-key / capture-pane -S -102400 -J \; new-window 'vim -c ":read !tmux save-buffer - ; tmux delete-buffer;" -c ":normal gg" -c ":set buftype=nofile" -c ":silent! ChompWhitespace"'
set -g @catppuccin_date_time "%Y-%m-%d %H:%M"
set -g @catppuccin_window_tabs_enabled "on"
# clear history
# bind k send-keys -R \; clear-history
# copy mode
setw -g mode-keys vi
bind Escape copy-mode
unbind [
unbind p
bind p paste-buffer
bind -Tcopy-mode-vi v send -X begin-selection
bind -Tcopy-mode-vi y send -X copy-selection
bind -Tcopy-mode-vi Escape send -X cancel
# panes
bind - split-window -v -c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}"
bind C-z resize-pane -Z
bind g swap-pane -U
bind æ swap-pane -D
# panes
#set -g window-active-style 'bg=colour236'
#set -g window-style 'bg=black'
# 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' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
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 -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
bind-key -T copy-mode-vi 'C-\' select-pane -l
# Utils
bind -r g display-popup -d '#{pane_current_path}' -w80% -h80% -E lazygit