From c89be0f5cc28b4c3d5e95e86c4b8327482e4cf9c Mon Sep 17 00:00:00 2001 From: dimti Date: Tue, 15 Oct 2024 12:47:08 +0300 Subject: [PATCH] * update config for early tmux versions * use suffix for bash history from tmux pane number --- .shell-history | 6 +++++- .tmux.2.8.conf | 67 ++++++++++++++-------------------------------------------- .tmux.conf | 4 ++-- 3 files changed, 23 insertions(+), 54 deletions(-) diff --git a/.shell-history b/.shell-history index f542d9e..28b9845 100644 --- a/.shell-history +++ b/.shell-history @@ -7,7 +7,11 @@ fi # Add the tty to the history file # Each terminal's history will be stored in # its own file -HISTSUFFIX=`tty | sed 's/\///g;s/^dev//g'` +if [ ! -z "${TMUX_PANE}" ]; then + HISTSUFFIX="${TMUX_PANE}" +else + HISTSUFFIX=`tty | sed 's/\///g;s/^dev//g'` +fi HISTFILE="$HOME/.bash_history_log/bash_history_$HISTSUFFIX" # Time stamp for the history diff --git a/.tmux.2.8.conf b/.tmux.2.8.conf index 7784375..4349d55 100644 --- a/.tmux.2.8.conf +++ b/.tmux.2.8.conf @@ -18,33 +18,20 @@ set -g @plugin 'knakayama/tmux-newline-detector' set -g @plugin 'anghootys/tmux-ip-address' set -g @plugin 'tmux-plugins/tmux-prefix-highlight' -# List of disabled plugins on some reasons -#set -g @plugin 'thewtex/tmux-mem-cpu-load' -#set -g @plugin 'b0o/tmux-autoreload' -#set -g @plugin 'ofirgall/tmux-window-name' -#set -g @plugin 'tmux-plugins/tmux-sidebar' -#set -g @treemux-tree-nvim-init-file '~/.tmux/plugins/treemux/configs/treemux_init.lua' -#set -g @plugin 'kiyoon/treemux' -#set -g @plugin 'leighmcculloch/tmux-colours-superhero' -#run-shell "powerline-daemon -q" -#source "/usr/share/powerline/bindings/tmux/powerline.conf" - ## Plugin configuration set -g @continuum-restore 'on' set -g @continuum-save-interval '5' set -g @resurrect-capture-pane-contents 'on' set -g @yank_selection 'primary' +set -g @yank_selection_mouse 'clipboard' set -g @man-size '40%' set -g @man-orientation 'h' set -g @man-shell-interactive 'off' -#set-option -g @tmux-autoreload-entrypoints '~/.tmux.conf' -#set -g @tmux-autoreload-quiet 1 -#set -g @sidebar-tree-position 'right' -# True colors (via: https://jdhao.github.io/2018/10/19/tmux_nvim_true_color/ ) -set -g default-terminal "screen-256color" -# tell Tmux that outside terminal supports true color -set -ag terminal-overrides ",alacritty:RGB" +# Tmux system configuration +set-option -gq display-time "2600" + +set -g default-terminal "xterm-256color" # --- START colours superhero --- @@ -57,18 +44,21 @@ set -g status-interval 1 # Status bar # not suppoerted option #set -g status-utf8 on -set -g status-bg default +set -g status-bg black set -g status-fg white # Status bar - left side -set -g status-left '' +set -g status-left-length 50 +set -g status-left-fg white +set -g status-right-attr bold +set -g status-left-bg blue +set -g status-left '#(if [ "#S" -ge 0 ]; then echo " "; else echo " #S "; fi)' # Status bar - right side set -g status-right-length 100 set -g status-right-fg black set -g status-right-attr bold -wg_is_keys_off="#[fg=$color_light,bg=$color_window_off_indicator]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')#[default]" -set -g status-right "$wg_is_keys_off #{prefix_highlight} #{?window_zoomed_flag,#[fg=colour178]ZOOMED #[fg=colour238]• ,}#[fg=colour178]#h #[fg=colour238]• #[fg=colour178]#{ip_address} #[fg=colour238]• #[fg=colour178]%a %b %d #[fg=colour178]%I:%M%P " +set -g status-right '#{prefix_highlight} #{?window_zoomed_flag,#[fg=colour178]ZOOMED #[fg=colour238]• ,}#[fg=colour178]#h #[fg=colour238]• #[fg=colour178]#{ip_address} #[fg=colour238]• #[fg=colour178]%a %b %d #[fg=colour178]%I:%M%P ' # Window status - not the current window set-window-option -g window-status-bg default @@ -92,27 +82,6 @@ set-option -g display-panes-colour colour240 # --- END colours superhero --- -## Windows style -#set-option -g status-style fg=yellow,bg=default -#set-window-option -g pane-active-border-style '' - -## A bit more space in right status bar -#set -g status-right-length 50 - -## Windows status style -#set -g status-style "bg=#4c566a,fg=#eceff4" -#set -g status-left "#[fg=#bf616a,bg=#ebcb8b,bold] #S " -#set -g status-right "#{prefix_highlight} #[bg=#a3be8c,fg=black,bold] #U #[bg=#ebcb8b,fg=#bf616a,bold] #h " -#setw -g window-status-format "#[fg=#81a1c1,bg=#4c566a] #I:#W " -#setw -g window-status-current-format "#[fg=#2e3440,bg=#81a1c1,bold] #I:#W " -#setw -g window-status-separator "" - -## Rename windows to fit current application -#setw -g automatic-rename on - -# Use zsh regardless of default settings -if-shell 'test -x /usr/bin/zsh' 'set-option -g default-shell /usr/bin/zsh' - # switch panes using Alt-arrow without prefix bind -n M-Left select-pane -L bind -n M-Right select-pane -R @@ -122,14 +91,10 @@ bind -n M-Down select-pane -D ## Mouse On by default set -g mouse on -# PageUp/PageDown works for scrolling -bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage" -bind-key -T copy-mode-vi PPage send-keys -X page-up -bind-key -T copy-mode-vi NPage send-keys -X page-down - -# Same for the mouse scroll button -bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M" -bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" +## Scoll for vim +bind -n WheelUpPane if "echo #{pane_current_command} | grep vim" "select-pane -t =; send-keys -N 4 Up" "select-pane -t =; copy-mode -e; send-keys -M" +bind -n WheelDownPane if "echo #{pane_current_command} | grep vim" "select-pane -t =; send-keys -N 4 Down" "select-pane -t =; send-keys -M" +# And additional scrolling things for tmux copy-mode bind-key -T copy-mode-vi WheelUpPane send-keys -X halfpage-up bind-key -T copy-mode-vi WheelDownPane send-keys -X halfpage-down diff --git a/.tmux.conf b/.tmux.conf index 324b880..5188ceb 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,5 +1,5 @@ ## Prefix like in screen -set -g prefix 'C-a' +set -g prefix 'C-d' ## Use xterm keys (makes eg. Ctrl+Arrow navigate words) set-window-option -g xterm-keys on @@ -76,7 +76,7 @@ set-option -g display-panes-colour colour240 # --- END colours superhero --- # Use zsh regardless of default settings -if-shell 'test -x /usr/bin/zsh' 'set-option -g default-shell /usr/bin/zsh' +#if-shell 'test -x /usr/bin/zsh' 'set-option -g default-shell /usr/bin/zsh' # switch panes using Alt-arrow without prefix bind -n M-Left select-pane -L