From de7af88f2ba9eaba1b41cd4d6809a35c64c2be74 Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Tue, 12 Mar 2024 23:12:39 -0400 Subject: [PATCH] Added tmux configuration --- .tmux.conf | 1 + .tmux/tmux.conf | 210 +++++++++++++++++++++++++++++++++++++++++ .tmux/tmux.local.conf | 35 +++++++ .tmux/tmux.remote.conf | 77 +++++++++++++++ 4 files changed, 323 insertions(+) create mode 120000 .tmux.conf create mode 100644 .tmux/tmux.conf create mode 100644 .tmux/tmux.local.conf create mode 100644 .tmux/tmux.remote.conf diff --git a/.tmux.conf b/.tmux.conf new file mode 120000 index 0000000..d7570cd --- /dev/null +++ b/.tmux.conf @@ -0,0 +1 @@ +.tmux/tmux.conf \ No newline at end of file diff --git a/.tmux/tmux.conf b/.tmux/tmux.conf new file mode 100644 index 0000000..bc4d51d --- /dev/null +++ b/.tmux/tmux.conf @@ -0,0 +1,210 @@ +# ========================== +# === General Settings === +# ========================== + +#set-option -sa terminal-overrides ",$TERM:RGB" +#set-option -ga terminal-overrides ",$TERM:Tc" +#set -g default-terminal "screen-256color" +#set -g default-terminal "tmux-256color" +set -g history-limit 5000 +set -g buffer-limit 20 +set -sg escape-time 10 +set -g display-time 1000 +setw -g remain-on-exit off +set -g repeat-time 600 +setw -g allow-rename on +setw -g automatic-rename on +setw -g aggressive-resize off + +set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support +set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colors - needs tmux-3.0 + +# Change prefix key to C-a, easier to type, same as "screen" +unbind C-b +set -g prefix C-a + +# Start index of window/pane with 1, because we're humans, not computers +set -g base-index 1 +setw -g pane-base-index 1 + +# Enable mouse support +set -g mouse on + + +# Bindings +set -g prefix C-a +bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced' + +#bind-key -n Home send Escape "OH" +#bind-key -n End send Escape "OF" + +# ========================== +# === Key Bindings === +# ========================== + +# Unbind default key bindings, we're going to override +unbind % # split-window -h +unbind '"' # split-window +unbind l # last-window +unbind & # kill-window +unbind = # choose-buffer +unbind ] # paste-buffer + +# Navigation +bind -n M-Right next-window +bind -n M-Left previous-window + +# Synchronization +#bind-key -n F2 set-window-option synchronize-panes + +# Window/Session +bind-key n command-prompt -p "rename-window:" -I "#{window_name}" "rename-window '%%'" +bind-key N command-prompt -p "rename-session:" -I "#{session_name}" "rename-session '%%'" +bind - split-window -v +bind _ split-window -h +bind > swap-pane -D # swap current pane with the next one +bind < swap-pane -U # swap current pane with the previous one +bind C-c new-session +bind Tab last-window +bind C-a last-window +bind b send-prefix +bind X confirm-before -p "kill-window #W? (y/n)" kill-window + +# ================================================ +# === Copy mode, scroll and clipboard === +# ================================================ +#set -g @copy_use_osc52_fallback off +set -s set-clipboard on +#set -as terminal-features ',screen-256color:clipboard' +set -sa terminal-features ",alacritty*:256:RGB:bpaste:clipboard:mouse:strikethrough:title:ccolour:cstyle:focus:overline:usstyle:hyperlinks:sync" + +# Prefer vi style key table +setw -g mode-keys vi + +bind p paste-buffer +bind C-p choose-buffer + +# trigger copy mode by (not working for me) +#bind -n M-Up copy-mode + +yank="~/.tmux/yank.sh" + +# Copy selected text (removed for testing) +#bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "$yank" +#bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "$yank" +##bind -T copy-mode-vi Y send-keys -X copy-line \;\ +## run "tmux save-buffer - | $yank" +#bind -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel "$yank; tmux paste-buffer" +#bind -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel "$yank" +#bind-key -T copy-mode-vi D send-keys -X copy-end-of-line \;\ +# run "tmux save-buffer - | $yank" +#bind-key -T copy-mode-vi A send-keys -X append-selection-and-cancel \;\ +# run "tmux save-buffer - | $yank" + +## Copy selection on drag end event, but do not cancel copy mode and do not clear selection +## clear select on subsequence mouse click +##bind -T copy-mode-vi MouseDragEnd1Pane \ +## send-keys -X copy-pipe "$yank" +#unbind -T copy-mode-vi MouseDragEnd1Pane +#bind -T copy-mode-vi MouseDown1Pane select-pane \;\ +# send-keys -X copy-pipe "$yank" \;\ +# send-keys -X clear-selection +# End (removed for testing) Section + + +set -g bell-action any +set -g default-command "" +set -g default-shell "/usr/bin/bash" +set -g destroy-unattached off +set -g detach-on-destroy on +set -g display-panes-active-colour "#00afff" +set -g display-panes-colour "#00afff" +set -g display-panes-time 800 +set -g renumber-windows on +set -g status-keys vi +set -g status-interval 4 +set -g visual-activity off +set -g visual-bell off +set -g visual-silence off + +setw -g alternate-screen on +setw -g clock-mode-style 24 +# Removed in 2.9 +#setw -g force-height 0 +#setw -g force-width 0 +setw -g main-pane-height 24 +setw -g main-pane-width 80 +setw -g monitor-activity on +setw -g monitor-bell on +setw -g monitor-silence 0 +setw -g other-pane-height 0 +setw -g other-pane-width 0 + +setw -g wrap-search on +setw -g xterm-keys on + + +set -g status-position top +set -g set-titles on +set -g set-titles-string "#h ❐ #S ● #I #W" + + +set -g status-left-length 1000 +set -g status-right-length 1000 + +set -g status-left "#[fg=#000000,bg=#ffff00,bold] ❐ #S #[fg=#ffff00,bg=default,none] " +set -g status-right '#[fg=#000000]#{prefix}#{synchronized}#{sharedsession}#[fg=#8a8a8a,bg=#000000]#[fg=#e4e4e4] #{cpu_icon} #[fg=#8a8a8a]#[fg=#e4e4e4] %R #[fg=#8a8a8a]#[fg=#e4e4e4] %d %b #[fg=#d70000]#[fg=#ffffff,bg=#d70000] #{username} #[fg=#e4e4e4,bg=#d70000,bold]#[fg=#000000,bg=#e4e4e4] #{hostname} #[bg=default]' + +set -g status-style "fg=#8a8a8a,bg=#080808" +set -g status-left-style "fg=#8a8a8a,bg=#080808" +set -g status-right-style "fg=#8a8a8a,bg=#080808" + +set -g message-style "fg=#000000,bg=#ffff00,bright" +set -g message-command-style "fg=#ffff00,bg=#000000,bright" + +setw -g automatic-rename-format "#{?pane_in_mode,[tmux],#{pane_current_command}}#{?pane_dead,[dead],}" +setw -g clock-mode-colour "#00afff" +setw -g mode-style "fg=#000000,bg=#ffff00,bright" +setw -g pane-active-border-style "fg=#00afff" +setw -g pane-border-format "#{?pane_active,#[reverse],}#{pane_index}#[default] \"#{pane_title}\"" +setw -g pane-border-status off +setw -g pane-border-style "fg=#444444" + +setw -g window-style default +setw -g window-active-style "bg=default" +#setw -g window-active-style "bg=#000000" +setw -g window-status-format "#I #W" +setw -g window-status-style "fg=#8a8a8a,bg=#080808" +setw -g window-status-last-style "fg=#00afff,bg=#080808,bright" +setw -g window-status-activity-style underscore +setw -g window-status-bell-style "fg=#ffff00,bright,blink" +#setw -g window-status-current-format "#[fg=#080808,bg=#00afff]#[fg=default,bg=default,default] #I #W #[fg=#00afff,bg=#080808,none]" +setw -g window-status-current-format "#[fg=#080808,bg=#00afff]#[fg=#080808,bg=#00afff,bright] #I #W #[fg=#00afff,bg=#080808,none]" +#setw -g window-status-current-style "fg=#000000,bg=#00afff,bright" +setw -g window-status-separator " " + + +# ============================ +# === Plugins === +# ============================ +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-cpu' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'https://git.linux-help.org/psi-jack/tmux-host.git' +set -g @plugin 'https://git.linux-help.org/psi-jack/tmux-indicators.git' + +set -g @yank_action 'copy-pipe' + +# ============================================= +# === Nesting local and remote sessions === +# ============================================= + +# Load modular configuration +if-shell 'test -n "$SSH_CLIENT"' \ + 'source-file ~/.tmux/tmux.remote.conf' \ + 'source-file ~/.tmux/tmux.local.conf' + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run -b '~/.tmux/plugins/tpm/tpm' + diff --git a/.tmux/tmux.local.conf b/.tmux/tmux.local.conf new file mode 100644 index 0000000..2d56397 --- /dev/null +++ b/.tmux/tmux.local.conf @@ -0,0 +1,35 @@ +# Toggle Inception +bind -T root M-S-Down \ + send-keys M-F12 \;\ + set prefix None \;\ + set key-table off \;\ + set status-style "fg=#8a8a8a,bg=#444444,none" \;\ + set status-left-style "fg=#8a8a8a,bg=#444444,none" \;\ + set status-right-style "fg=#8a8a8a,bg=#444444,none" \;\ + setw window-status-current-style "fg=#000000,bg=#00afff,bold" \;\ + setw -g window-status-style "fg=#8a8a8a,bg=#444444" \;\ + setw -g window-status-last-style "fg=#00afff,bg=#444444" \;\ + setw window-status-current-format "#[fg=#444444,bg=#00afff]#[fg=default,bg=default,default] #I #W #[fg=#00afff,bg=#444444,none]" \;\ + refresh-client -S \;\ + #setw -g window-status-style "fg=#8a8a8a,bg=#444444" \;\ + #setw -g window-status-last-style "fg=#00afff,bg=#444444" \;\ + #setw window-status-current-format "#[fg=#444444,bg=#00afff]#[fg=default,bg=default,default] #I #W #[fg=#00afff,bg=#444444,none]" \;\ + +bind -T off M-S-Up \ + send-keys M-F12 \;\ + set -u prefix \;\ + set -u key-table \;\ + set -u status-style \;\ + set -u status-left-style \;\ + set -u status-right-style \;\ + setw -u window-status-current-style \;\ + setw -g window-status-style "fg=#8a8a8a" \;\ + setw -g window-status-last-style "fg=#00afff" \;\ + setw -u window-status-current-format \;\ + refresh-client -S + #setw -g window-status-style "fg=#8a8a8a,bg=#000000" \;\ + #setw -g window-status-last-style "fg=#00afff,bg=#000000" \;\ + +# Start a new session called default, if starting new. +new-session -s default + diff --git a/.tmux/tmux.remote.conf b/.tmux/tmux.remote.conf new file mode 100644 index 0000000..5bb761e --- /dev/null +++ b/.tmux/tmux.remote.conf @@ -0,0 +1,77 @@ +# Toggle Inception + +# show status bar at bottom for remote session, +# so it do not stack together with local session's one +set -g status-position bottom + +# Since this is a remote SSH, disable by default until signalled by origin. +set -g key-table off +#set -g status-left "#[fg=#000000,bg=#ffff00,bold]$tmux_conf_theme_status_left#[fg=#ffff00,bg=default,none]$tmux_conf_theme_left_separator_main " +#set -g status-right "#[fg=#080808,bg=default,none]#[fg=#8a8a8a,bg=#080808,none]#[fg=none]#[bg=none]#[none]#{?client_prefix,⌨️ ,}#[fg=none]#[bg=none]#[none]#{?session_many_attached,👓 ,}#[fg=#8a8a8a,bg=#080808,none] #{?pane_synchronized,#[fg=none]#[bg=none]#[none]#{?pane_synchronized,🔁 ,},⤴️ }" +set -g status-style "fg=#8a8a8a,bg=#444444,none" +set -g status-left-style "fg=#8a8a8a,bg=#444444,none" +set -g status-right-style "fg=#8a8a8a,bg=#444444,none" +setw -g window-status-style "fg=#8a8a8a,bg=#444444" +setw -g window-status-format "#I #W" +setw -g window-status-last-style "fg=#00afff,bg=#444444" +setw -g window-status-current-style "fg=#000000,bg=#00afff,bold" +setw -g window-status-current-format "#[fg=#444444,bg=#00afff]#[fg=default,bg=default,default] #I #W #[fg=#00afff,bg=#444444,none]" + +bind -T off M-F12 \ + set prefix C-a \;\ + set -gu key-table \;\ + set -u key-table \;\ + set -g status-style "fg=#8a8a8a,bg=#080808,none" \;\ + set -g status-left-style "fg=#8a8a8a,bg=#080808,none" \;\ + set -g status-right-style "fg=#8a8a8a,bg=#080808,none" \;\ + setw -g window-status-style "fg=#8a8a8a,bg=#080808" \;\ + setw -g window-status-last-style "fg=#00afff,bg=#080808" \;\ + setw -g window-status-current-style "fg=#000000,bg=#00afff,bold" \;\ + setw -g window-status-current-format "#[fg=#080808,bg=#00afff]#[fg=default,bg=default,default] #I #W #[fg=#00afff,bg=#080808,none]" \;\ + refresh-client -S \;\ + +bind -T root M-F12 \ + set -u prefix \;\ + set key-table off \;\ + set -g status-style "fg=#8a8a8a,bg=#444444,none" \;\ + set -g status-left-style "fg=#8a8a8a,bg=#444444,none" \;\ + set -g status-right-style "fg=#8a8a8a,bg=#444444,none" \;\ + setw -g window-status-current-style "fg=#000000,bg=#00afff,bold" \;\ + setw -g window-status-style "fg=#00afff,bg=#444444" \;\ + setw -g window-status-last-style "fg=#00afff,bg=#444444" \;\ + setw -g window-status-current-format "#[fg=#444444,bg=#00afff]#[fg=default,bg=default,default] #I #W #[fg=#00afff,bg=#444444,none]" \;\ + refresh-client -S + +#bind -T off M-F12 \ +# set prefix C-a \;\ +# set -gu key-table \;\ +# set -u status-style \;\ +# set -u status-left-style \;\ +# set -u status-right-style \;\ +# setw -u window-status-current-style \;\ +# setw -g window-status-style "fg=#8a8a8a,bg=#000000" \;\ +# setw -g window-status-last-style "fg=#00afff,bg=#000000" \;\ +# setw -u window-status-current-format \;\ +# refresh-client -S +# +#bind -T root M-F12 \ +# set -u prefix \;\ +# set key-table off \;\ +# set status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_off_status_bg,$tmux_conf_theme_status_attr" \;\ +# set status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_off_status_bg,$tmux_conf_theme_status_attr" \;\ +# set status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_off_status_bg,$tmux_conf_theme_status_attr" \;\ +# setw window-status-current-style "fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr" \;\ +# setw -g window-status-style "fg=#8a8a8a,bg=#444444" \;\ +# setw -g window-status-last-style "fg=#00afff,bg=#444444" \;\ +# setw window-status-current-format "#[fg=#444444,bg=#00afff]#[fg=default,bg=default,default] #I #W #[fg=#00afff,bg=#444444,none]" \;\ +# refresh-client -S + + +# Set port of SSH remote tunnel, where tmux will pipe buffers to transfer on local machine for copy +#set -g @copy_backend_remote_tunnel_port 11988 + +# In remote mode we don't show "clock" and "battery status" widgets +#set -g status-left "$wg_session" +#set -g status-right "#{prefix_highlight} $wg_is_keys_off $wg_is_zoomed #{sysstat_cpu} | #{sysstat_mem} | #{sysstat_loadavg} | $wg_user_host | #{online_status}" + +new-session -s default