From 668e2c6ef3e246f9fccce6c43cf9bf0960594274 Mon Sep 17 00:00:00 2001 From: Tomas Mirchev Date: Wed, 1 Oct 2025 00:20:03 +0300 Subject: [PATCH] add tmux --- config/linux-dev/tmux | 71 ----------------------------- config/linux-vm/tmux | 102 +++++++++++++++++++----------------------- config/shared/bin/dev | 12 +++-- config/shared/tmux | 63 -------------------------- 4 files changed, 50 insertions(+), 198 deletions(-) delete mode 100644 config/linux-dev/tmux delete mode 100644 config/shared/tmux diff --git a/config/linux-dev/tmux b/config/linux-dev/tmux deleted file mode 100644 index 13fa2bb..0000000 --- a/config/linux-dev/tmux +++ /dev/null @@ -1,71 +0,0 @@ -# Change the prefix from 'C-b' to 'C-Space' -unbind C-b -set-option -g prefix C-Space -bind-key C-Space send-prefix -set-option -g set-clipboard on - - -set -g default-terminal "xterm-256color" -#set -as terminal-features ",*:RGB" -# set-option -a terminal-features 'xterm-256color:RGB' -set-option -sg escape-time 10 -set-option -g repeat-time 0 -set-option -g focus-events on - -# Set the base index for windows and panes to 1 instead of 0 -set -g base-index 1 -setw -g pane-base-index 1 - -# Increase scrollback buffer size -set -g history-limit 10000 - -# Light theme with transparent background -set -g status-style bg=default,fg='#4c4f69' -set -g status-left '#[fg=blue,bold][#S] ' -set -g status-left-length 50 -set -g status-right '' - -# set -g pane-border-status bottom # or 'bottom' if status is at top -# set -g pane-border-format '─' # This will fill the entire width automatically - -# Window status format - light theme with terminal blue -setw -g window-status-format '#[fg=#6c6f85]#I#[fg=#9ca0b0]:#[fg=#4c4f69]#W#[fg=#9ca0b0]#F' -setw -g window-status-current-format '#[fg=blue,bold]#I#[fg=#9ca0b0]:#[fg=blue,bold]#W#[fg=#9ca0b0]#F' - -# Pane border - light theme -set -g pane-border-style fg='#ccd0da' -set -g pane-active-border-style fg=blue - -# Message text - light theme -set -g message-style bg='#eff1f5',fg=blue - -# Copy mode colors - light theme -setw -g mode-style bg='#acb0be',fg='#4c4f69' - -# Enable mouse support -setw -g mouse on - -# Fix scroll. Use N3 instead of N1 to make it quicker -bind-key -T copy-mode-vi WheelUpPane send -N1 -X scroll-up -bind-key -T copy-mode-vi WheelDownPane send -N1 -X scroll-down - -# Update terminal titles -set-option -g set-titles off - -# Use vim keybindings in copy mode -setw -g mode-keys vi - -# Setup 'v' to begin selection as in Vim -bind -T copy-mode-vi v send-keys -X begin-selection - -# Pane navigation using vim-like keys -bind -r k select-pane -U -bind -r j select-pane -D -bind -r h select-pane -L -bind -r l select-pane -R - -# Automatically renumber windows when one is closed -set -g renumber-windows on - -# Reload tmux config -bind r source-file ~/.tmux.conf \; display "Reloaded!" diff --git a/config/linux-vm/tmux b/config/linux-vm/tmux index d10286f..7c4055f 100644 --- a/config/linux-vm/tmux +++ b/config/linux-vm/tmux @@ -1,70 +1,58 @@ -# Change the prefix from 'C-b' to 'C-Space' +##### Prefix ##### unbind C-b -set-option -g prefix C-Space -bind-key C-Space send-prefix +set -g prefix C-Space +bind C-Space send-prefix -set-option -g set-clipboard on +##### General ##### +set -s default-terminal "tmux-256color" +set -s escape-time 10 +set -s focus-events on +set -s set-clipboard on -#set -g default-terminal "tmux-256color" -#set -as terminal-features ",*:RGB" -set-option -a terminal-features 'xterm-256color:RGB' -set-option -sg escape-time 10 -set-option -g repeat-time 0 -set-option -g focus-events on - -# Set the base index for windows and panes to 1 instead of 0 -set -g base-index 1 -setw -g pane-base-index 1 - -# Increase scrollback buffer size +set -g base-index 1 # window index +set -g renumber-windows on # window index set -g history-limit 10000 +set -g repeat-time 0 +set -g mouse on +set -g set-titles on +set -g set-titles-string "#S" -# Customize the status bar for Catppuccin Latte -set -g status-style bg=default,fg='#4c4f69' # Catppuccin Latte text color -set -g status-left '#[fg=#1e66f5,bold][#S] ' # Catppuccin Latte blue for session +set -gw pane-base-index 1 # pane index +set -gw synchronize-panes on + +##### Appearance ##### +set -g status-style fg=black,bg=default +set -g window-status-current-style fg=blue,bold +set -g message-style fg=blue,bg=default +set -g status-left "#[fg=blue,bold][#S] " +set -g status-right "host:#H | machine:#{?TARGET_MACHINE,#{TARGET_MACHINE},local}" set -g status-left-length 50 -set -g status-right '' +set -g status-right-length 50 +set -g pane-active-border-style fg=blue -# Optional: Style the window tabs to match -set -g window-status-current-style 'fg=#4c4f69,bold' # Active window - dark text, bold -set -g window-status-style 'fg=#6c6f85' # Inactive windows - lighter text -set -g window-status-separator ' | ' # Clean separator - -# Optional: Style the borders to match (if you use pane borders) -set -g pane-border-style 'fg=#ccd0da' # Light border for inactive panes -set -g pane-active-border-style 'fg=#1e66f5' # Blue border for active pane - -set -g status-left-length 20 -set -g status-right-length 20 -set -g pane-border-format "" -# Message text -set -g message-style bg=default,fg=cyan - -# Enable mouse support -setw -g mouse on - -# Fix scroll. Use N3 instead of N1 to make it quicker -bind-key -T copy-mode-vi WheelUpPane send -N1 -X scroll-up -bind-key -T copy-mode-vi WheelDownPane send -N1 -X scroll-down - -# Update terminal titles -set-option -g set-titles on -set-option -g set-titles-string "#S" - -# Use vim keybindings in copy mode -setw -g mode-keys vi - -# Setup 'v' to begin selection as in Vim +##### Vim-like ##### +set -gw mode-keys vi bind -T copy-mode-vi v send-keys -X begin-selection - -# Pane navigation using vim-like keys -bind -r k select-pane -U -bind -r j select-pane -D +bind -T copy-mode-vi WheelUpPane send -N1 -X scroll-up +bind -T copy-mode-vi WheelDownPane send -N1 -X scroll-down bind -r h select-pane -L +bind -r j select-pane -D +bind -r k select-pane -U bind -r l select-pane -R -# Automatically renumber windows when one is closed -set -g renumber-windows on +unbind '"' +unbind "%" +unbind s +unbind c +unbind n +unbind x -# Reload tmux config +bind s split-window -v -c "#{pane_current_path}" +bind v split-window -h -c "#{pane_current_path}" +bind o choose-session +bind n new-window +bind c confirm-before -p "kill-pane \#P? (y/n)" kill-pane + +##### Misc ##### bind r source-file ~/.tmux.conf \; display "Reloaded!" + diff --git a/config/shared/bin/dev b/config/shared/bin/dev index f20f86e..76ecd6d 100755 --- a/config/shared/bin/dev +++ b/config/shared/bin/dev @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -euo pipefail REGISTRY="registry.tomastm.com" @@ -33,7 +33,7 @@ NAME="$1" CONTAINER_NAME="${IMAGE##*/}-${NAME}" # Use only the base image name (without tag) exec_into_container() { - docker exec --detach-keys "ctrl-q,ctrl-p" -it "$CONTAINER_NAME" bash -c "tmux new -A -s $NAME" + docker exec --detach-keys "ctrl-q,ctrl-p" -it "$CONTAINER_NAME" bash -c "zsh" } # Check if the container exists @@ -48,17 +48,15 @@ if [ "$(docker ps -a -q -f "name=$CONTAINER_NAME")" ]; then else echo "Container $CONTAINER_NAME does not exist. Creating and running it in detached mode..." docker run -d \ - --detach-keys "ctrl-q,ctrl-p" \ --network host \ -v "$HOME/.ssh:/home/dev/.ssh" \ -v "$PWD:/workspace" \ -v /var/run/docker.sock:/var/run/docker.sock \ - --group-add $(getent group docker | cut -d: -f3) \ + --group-add "$(getent group docker | cut -d: -f3)" \ --name "$CONTAINER_NAME" \ - --init \ + --init \ # run tini as PID 1 to handle signals & reap zombies for cleaner container shutdown "$FULL_IMAGE_NAME" \ - sleep infinity - # tail -f /dev/null + sleep infinity # use if coreutils not available: tail -f /dev/null fi echo "Executing into container $CONTAINER_NAME..." diff --git a/config/shared/tmux b/config/shared/tmux deleted file mode 100644 index 6949bd1..0000000 --- a/config/shared/tmux +++ /dev/null @@ -1,63 +0,0 @@ -# Change the prefix from 'C-b' to 'C-Space' -unbind C-b -set-option -g prefix C-Space -bind-key C-Space send-prefix - -#set -g default-terminal "tmux-256color" -#set -as terminal-features ",*:RGB" -set-option -a terminal-features 'xterm-256color:RGB' -set-option -sg escape-time 10 -set-option -g repeat-time 0 -set-option -g focus-events on - -# Set the base index for windows and panes to 1 instead of 0 -set -g base-index 1 -setw -g pane-base-index 1 - -# Increase scrollback buffer size -set -g history-limit 10000 - -# Customize the status bar -set -g status-style bg=default,fg=white -set -g status-left '#[fg=cyan,bold][#S] ' -set -g status-left-length 50 -set -g status-right '' - -# Window status format -setw -g window-status-format '#[fg=white,dim]#I#[fg=grey]:#[fg=white]#W#[fg=grey]#F' -setw -g window-status-current-format '#[fg=cyan,bold]#I#[fg=blue]:#[fg=cyan]#W#[fg=grey]#F' - -# Pane border -set -g pane-border-style fg=colour240 -set -g pane-active-border-style fg=cyan - -# Message text -set -g message-style bg=default,fg=cyan - -# Enable mouse support -setw -g mouse on - -# Fix scroll. Use N3 instead of N1 to make it quicker -bind-key -T copy-mode-vi WheelUpPane send -N1 -X scroll-up -bind-key -T copy-mode-vi WheelDownPane send -N1 -X scroll-down - -# Update terminal titles -set-option -g set-titles on - -# Use vim keybindings in copy mode -setw -g mode-keys vi - -# Setup 'v' to begin selection as in Vim -bind -T copy-mode-vi v send-keys -X begin-selection - -# Pane navigation using vim-like keys -bind -r k select-pane -U -bind -r j select-pane -D -bind -r h select-pane -L -bind -r l select-pane -R - -# Automatically renumber windows when one is closed -set -g renumber-windows on - -# Reload tmux config -bind r source-file ~/.tmux.conf \; display "Reloaded!"