From 3c8e35be2467ec06f4050f2edcf968a53ec64cd4 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Tue, 5 Sep 2023 22:10:38 +0200 Subject: [PATCH] add tmux conf --- .gitignore | 1 + .tmux.conf | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 .tmux.conf diff --git a/.gitignore b/.gitignore index 986433e..15b310f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ !.config/kitty !.gitignore !.zsh +!.tmux.conf diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..e604436 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,140 @@ +# thanks to this awesome guide: https://thevaluable.dev/tmux-config-mouseless/ (visited 2023-02-04 + +# make ctrl-space the prefix. Keep ctrl-b as an alternative. +#unbind C-b +set -g prefix2 C-Space + +# enable using the mouse +set -g mouse on + +# 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 + +# split horizontal with or prefix-" +#bind h split-window -h -c "#{pane_current_path}" +bind '"' split-window -h -c "#{pane_current_path}" + +# split vertical with or prefix-% +#bind v split-window -v -c "#{pane_current_path}" +bind % split-window -v -c "#{pane_current_path}" + +# navigate panels with vim or arrow keys +# arrows are the default +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# reorder panels with prefix+shift+{jk} +bind K swap-pane -U +bind J swap-pane -D + +# rotate panels with prefix+ctrl+o and prefix+ctrl+shift+o (reversed) +# default + +# rename windows/sessions with prefix-n- +unbind n #DEFAULT KEY: Move to next split-window +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 '%%'" + +# 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. +# change the copy mode key to prefix-N , the default config isnt good for qwertz keyboards. +bind-key N copy-mode + +# 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 + +# Use prefix-p to paste +unbind ] #Default for pasting +bind p paste-buffer + +unbind -T copy-mode-vi Space; #Default for begin-selection +unbind -T copy-mode-vi Enter; #Default for copy-selection + + +bind -T copy-mode-vi v send-keys -X begin-selection +# copy to wayland clipboard. If you use XORG use the commented version with xsel. +#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" + +# magic tweaks for better use with vim or neovim +#s#et -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator + +# send esc to the process instantly! +set-option -s escape-time 10 + +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" + +# 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" + +# use all colors +set -g default-terminal "screen-256color" +set-option -sa terminal-overrides ',XXX:RGB' + +# 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