From 790e2a871a2439b0475f051ffd61ecd57cd73c71 Mon Sep 17 00:00:00 2001 From: thek4n Date: Wed, 27 Mar 2024 00:54:29 +0300 Subject: [PATCH] tmux refactor --- home/user/.config/tmux/mappings.conf | 67 ++++++++++++++++++++ home/user/.config/tmux/options.conf | 27 ++++++++ home/user/.config/tmux/style.conf | 28 ++++++++ home/user/.config/tmux/tmux.conf | 95 ++-------------------------- 4 files changed, 126 insertions(+), 91 deletions(-) create mode 100644 home/user/.config/tmux/mappings.conf create mode 100644 home/user/.config/tmux/options.conf create mode 100644 home/user/.config/tmux/style.conf diff --git a/home/user/.config/tmux/mappings.conf b/home/user/.config/tmux/mappings.conf new file mode 100644 index 0000000..e4c2195 --- /dev/null +++ b/home/user/.config/tmux/mappings.conf @@ -0,0 +1,67 @@ +# vim: ft=tmux + +set -g prefix C-b + + +# Zoom pane +bind -n M-f resize-pane -Z + +# Panes navigation +bind -n M-h select-pane -L +bind -n M-l select-pane -R +bind -n M-j select-pane -D +bind -n M-k select-pane -U + + +# Windows navigation +bind -n C-M-h previous-window +bind -n C-M-l next-window +bind -n M-Tab last-window + +bind -n M-1 new-window -n 1 -S +bind -n M-2 new-window -n 2 -S +bind -n M-3 new-window -n 3 -S +bind -n M-4 new-window -n 4 -S +bind -n M-5 new-window -n 5 -S +bind -n M-6 new-window -n 6 -S +bind -n M-7 new-window -n 7 -S +bind -n M-8 new-window -n 8 -S +bind -n M-9 new-window -n 9 -S +bind -n M-0 new-window -n 10 -S + + +# Windows splitting +bind -n M-Enter split-window -h -c "#{pane_current_path}" +bind | split-window -h -c "#{pane_current_path}" +bind \\ split-window -v -c "#{pane_current_path}" + + +# Copy mode +setw -g mode-keys vi +bind-key C-v copy-mod +bind p paste-buffer +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi c send-keys -X clear-selection +bind-key -T copy-mode-vi y send-keys -X copy-selection +bind-key -T copy-mode-vi V send-keys -X rectangle-toggle + + +# Lock screen +bind-key -T prefix C-x confirm-before -p "lock tmux? (y/n)" lock-session + + +# Reload config +bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..." + + +# Session managment +bind 1 source-file ~/.tmux/01.conf +bind 2 source-file ~/.tmux/02.conf +bind 3 source-file ~/.tmux/03.conf +bind 4 source-file ~/.tmux/04.conf +bind 5 source-file ~/.tmux/05.conf +bind 6 source-file ~/.tmux/06.conf +bind 7 source-file ~/.tmux/07.conf +bind 8 source-file ~/.tmux/08.conf +bind 9 source-file ~/.tmux/09.conf +bind 0 source-file ~/.tmux/10.conf \ No newline at end of file diff --git a/home/user/.config/tmux/options.conf b/home/user/.config/tmux/options.conf new file mode 100644 index 0000000..5a6ce8c --- /dev/null +++ b/home/user/.config/tmux/options.conf @@ -0,0 +1,27 @@ +# vim: ft=tmux + +set -s exit-empty off # Server will not exit if no active sessions +set -s exit-unattached off # Server will not exit if no attached clients + + +set -g mouse on # Enable mouse support + +set -s escape-time 0 # Delay after escape +set -g repeat-time 0 # Disable multiple commands after prefix-key + +set -g base-index 1 # Window numbering starts at 1 +set -g pane-base-index 1 # Pane numbering starts at 1 +set -g renumber-windows on # Make windows auto renumber + +set -g history-limit 10000 # Scroll back history + + +setw -g aggressive-resize on # Resize windows on diff clients +set -g display-panes-time 4000 # Increase show pane time + +set -g lock-command vlock # Shell command to lock client + +set -g default-terminal "tmux-256color" +set -ga terminal-overrides ",xterm-256color:Tc" + +set -g default-command 'tmux rename-window -t 1 1; $SHELL' \ No newline at end of file diff --git a/home/user/.config/tmux/style.conf b/home/user/.config/tmux/style.conf new file mode 100644 index 0000000..428dff6 --- /dev/null +++ b/home/user/.config/tmux/style.conf @@ -0,0 +1,28 @@ +# vim: ft=tmux + + +set -g status-justify centre # center windows in statusline + +set -g status-left-length 40 +set -g status-left "[#S@#H]" +set -g status-right '%d.%m.%Y %H:%M' + +set -g status-style 'bg=default,fg=white' +set -g window-status-style 'bg=default' +set -g window-status-current-style 'bg=white,fg=black bold' +set -g window-status-format '#W#{?window_flags,#{window_flags}, }' +set -g window-status-current-format '#W#{?window_flags,#{window_flags}, }' + +set -g message-style 'fg=black bg=white bold' + +set -g set-titles on +set -g set-titles-string '#S:#I.#P #W' + + +# clock style +setw -g clock-mode-colour green +setw -g clock-mode-style 24 + +set -g bell-action none + +set -ga update-environment 'DISPLAY' # Maybe fix DISPLAY? \ No newline at end of file diff --git a/home/user/.config/tmux/tmux.conf b/home/user/.config/tmux/tmux.conf index a6b58ba..67fd18d 100644 --- a/home/user/.config/tmux/tmux.conf +++ b/home/user/.config/tmux/tmux.conf @@ -1,92 +1,5 @@ -set -g prefix C-b +# vim: ft=tmux -set -s exit-empty off -set -s exit-unattached off - -# pane navigation -bind | split-window -h -c "#{pane_current_path}" -bind \\ split-window -v -c "#{pane_current_path}" - -bind -n M-Enter split-window -h -c "#{pane_current_path}" -bind -n M-h select-pane -L -bind -n M-l select-pane -R -bind -n M-j select-pane -D -bind -n M-k select-pane -U -bind -n C-M-h previous-window -bind -n C-M-l next-window - -bind -n M-1 new-window -n 1 -S -bind -n M-2 new-window -n 2 -S -bind -n M-3 new-window -n 3 -S -bind -n M-4 new-window -n 4 -S -bind -n M-5 new-window -n 5 -S -bind -n M-6 new-window -n 6 -S -bind -n M-7 new-window -n 7 -S -bind -n M-8 new-window -n 8 -S -bind -n M-9 new-window -n 9 -S -bind -n M-0 new-window -n 10 -S - -bind -n M-f resize-pane -Z -bind -n M-Tab last-window - -set-option -ga terminal-overrides ",xterm-256color:Tc" - -set -g status-justify centre -set -g status-left-length 40 -set -g status-left "[#S@#H]" -set -g status-right '%d.%m.%Y %H:%M' - -set -g status-style 'bg=default,fg=white' -set -g window-status-style 'bg=default' -set -g window-status-current-style 'bg=white,fg=black bold' -set -g window-status-format '#W#{?window_flags,#{window_flags}, }' -set -g window-status-current-format '#W#{?window_flags,#{window_flags}, }' - -set -s escape-time 0 - -set -g message-style 'fg=black bg=white bold' -set-option -g bell-action none - -set -g mouse on -set-option -g repeat-time 0 - -set -ga update-environment 'DISPLAY' # Maybe fix DISPLAY? -set -g base-index 1 ## Window numbering starts at 1 -set -g pane-base-index 1 ## Pane numbering starts at 1 -setw -g aggressive-resize on ## Aggressive windows: For screen size, of diff connections, on diff windows -set -g default-terminal "tmux-256color" -set -g history-limit 10000 ## Scroll back history -set -g display-panes-time 4000 ## Increase show pane time -set -g renumber-windows on ## Make windows auto renumber -set -g lock-command vlock -set -g default-command 'tmux rename-window -t 1 1; $SHELL' - -bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..." - -## Lock screen -bind-key -T prefix C-x confirm-before -p "lock tmux? (y/n)" lock-session - -bind-key C-v copy-mod -setw -g mode-keys vi -bind p paste-buffer -bind-key -T copy-mode-vi v send-keys -X begin-selection -bind-key -T copy-mode-vi c send-keys -X clear-selection -bind-key -T copy-mode-vi y send-keys -X copy-selection -bind-key -T copy-mode-vi V send-keys -X rectangle-toggle - -set -g set-titles on -set -g set-titles-string '#S:#I.#P #W' - -setw -g clock-mode-colour green -setw -g clock-mode-style 24 - -bind 1 source-file ~/.tmux/01.conf -bind 2 source-file ~/.tmux/02.conf -bind 3 source-file ~/.tmux/03.conf -bind 4 source-file ~/.tmux/04.conf -bind 5 source-file ~/.tmux/05.conf -bind 6 source-file ~/.tmux/06.conf -bind 7 source-file ~/.tmux/07.conf -bind 8 source-file ~/.tmux/08.conf -bind 9 source-file ~/.tmux/09.conf -bind 0 source-file ~/.tmux/10.conf \ No newline at end of file +source-file "$XDG_CONFIG_HOME/tmux/mappings.conf" +source-file "$XDG_CONFIG_HOME/tmux/options.conf" +source-file "$XDG_CONFIG_HOME/tmux/style.conf" \ No newline at end of file