configs/home/.tmux.conf

137 lines
4.6 KiB
Plaintext
Raw Normal View History

2023-02-04 18:26:06 +01:00
# thanks to this awesome guide: https://thevaluable.dev/tmux-config-mouseless/ (visited 2023-02-04
2023-01-08 02:50:11 +01:00
2023-02-04 18:26:06 +01:00
# make ctrl-space the prefix. Keep ctrl-b as an alternative.
#unbind C-b
set -g prefix2 C-Space
# enable using the mouse
2023-01-08 02:50:11 +01:00
set -g mouse on
2023-02-04 18:26:06 +01:00
# prefix-r to reload the config file
# prefix-r to reload the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
# change split hotkeys
# v and h are not bound by default, but we never know in the next versions...
unbind v
unbind h
unbind % # Split vertically
unbind '"' # Split horizontally
2023-02-09 13:52:50 +01:00
# split horizontal with or prefix-"
#bind h split-window -h -c "#{pane_current_path}"
2023-02-04 18:26:06 +01:00
bind '"' split-window -h -c "#{pane_current_path}"
2023-02-09 13:52:50 +01:00
# split vertical with or prefix-%
#bind v split-window -v -c "#{pane_current_path}"
2023-02-04 18:26:06 +01:00
bind % split-window -v -c "#{pane_current_path}"
2023-02-05 13:49:18 +01:00
# navigate panels with vim or arrow keys
2023-02-09 13:52:50 +01:00
# arrows are the default
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
2023-02-04 18:26:06 +01:00
2023-02-05 13:49:18 +01:00
# reorder panels with prefix+shift+{jk}
2023-02-09 13:52:50 +01:00
bind K swap-pane -U
bind J swap-pane -D
2023-02-05 13:49:18 +01:00
# rotate panels with prefix+ctrl+o and prefix+ctrl+shift+o (reversed)
# default
2023-02-08 13:40:17 +01:00
# rename windows/sessions with prefix-n-<w|s>
2023-02-04 18:26:06 +01:00
unbind n #DEFAULT KEY: Move to next split-window
2023-02-08 13:40:17 +01:00
bind -T prefix n switch-client -T naming_table
bind -T naming_table s command-prompt "rename-session '%%'"
bind -T naming_table w command-prompt "rename-window '%%'"
2023-02-04 18:26:06 +01:00
# set the first window id to 1, I know computer scientists always start from 0, but 0 is so far away from my left hand.
# remember: prefix-{digit} brings you to the window with the id {digit}
set -g base-index 1
set-window-option -g pane-base-index 1
# next window with alt-k, last with alt-j, no prefix needed.
bind -n M-j previous-window
bind -n M-k next-window
# tmux modes stuff. we have default mode and copy mode.
2023-02-04 19:00:21 +01:00
# change the copy mode key to prefix-N , the default config isnt good for qwertz keyboards.
bind-key N copy-mode
2023-02-04 18:26:06 +01:00
# obviously use vim keys for copymode (think normal mode in vim)
# with these options we can yank the tmux copy stuff into the system clipboard.
set-window-option -g mode-keys vi
2023-02-04 19:20:33 +01:00
# Use prefix-p to paste
unbind ] #Default for pasting
bind p paste-buffer
2023-02-04 18:26:06 +01:00
unbind -T copy-mode-vi Space; #Default for begin-selection
unbind -T copy-mode-vi Enter; #Default for copy-selection
2023-02-04 19:20:33 +01:00
2023-02-04 18:26:06 +01:00
bind -T copy-mode-vi v send-keys -X begin-selection
2023-02-04 19:20:33 +01:00
# copy to wayland clipboard. If you use XORG use the commented version with xsel.
2023-02-04 19:00:21 +01:00
#bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel --clipboard"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
2023-02-04 18:26:06 +01:00
# magic tweaks for better use with vim or neovim
2023-02-05 13:49:18 +01:00
#s#et -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
2023-02-04 18:26:06 +01:00
# 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 -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
2023-02-05 13:49:18 +01:00
# shell comaptability stuff
is_shell="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(zsh|bash|sh)(diff)?$'"
# clear panel with ctrl-l (like bash or zsh)
unbind C-l # Default for go to last window
bind -n C-l if-shell "$is_shell" "bind -n C-l send-keys C-l ; run 'sleep 0.1' ; clear-history"
2023-02-07 08:54:50 +01:00
# use all colors
set -g default-terminal "screen-256color"
2023-02-04 18:26:06 +01:00
# theming, See https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-dark.conf
#### COLOUR (Solarized dark)
# default statusbar colors
set-option -g status-style fg=yellow,bg=black #yellow and base02
# default window title colors
set-window-option -g window-status-style fg=brightblue,bg=default #base0 and default
#set-window-option -g window-status-style dim
# active window title colors
set-window-option -g window-status-current-style fg=brightred,bg=default #orange and default
#set-window-option -g window-status-current-style bright
# pane border
set-option -g pane-border-style fg=black #base02
set-option -g pane-active-border-style fg=brightgreen #base01
# message text
set-option -g message-style fg=brightred,bg=black #orange and base01
# pane number display
set-option -g display-panes-active-colour brightred #orange
set-option -g display-panes-colour blue #blue
# clock
set-window-option -g clock-mode-colour green #green
# bell
set-window-option -g window-status-bell-style fg=black,bg=red #base02, red