From 75493e31ccce13a9b6b17b0d66d34e051422bef0 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 30 Jan 2026 13:32:20 +0100 Subject: [PATCH] tmux improvements + starship supports docker compose --- .starship.toml | 10 +++++++++- .tmux.conf | 10 +++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.starship.toml b/.starship.toml index 40ee9a3..d35e5ae 100644 --- a/.starship.toml +++ b/.starship.toml @@ -1,5 +1,5 @@ add_newline = true -format = """$git_branch$git_status$character""" +format = """${custom.docker_compose}$git_branch$git_status$character""" right_format = """$username[@](red)$hostname $cmd_duration$time $directory""" [git_branch] @@ -36,3 +36,11 @@ style = "green" [character] success_symbol = "[➤](green)" error_symbol = "[➤](red)" + +[custom.docker_compose] +command = '''docker compose ps --format json 2>/dev/null | jq -rs 'if length == 0 then halt else [group_by(.State) | .[] | "\(if .[0].State == "running" then "▲" else "▼" end)\(length)"] | "🐳 " + join("/") end' ''' +detect_files = ["docker-compose.yml", "docker-compose.yaml", "compose.yml", "compose.yaml"] +shell = ["bash", "--noprofile", "--norc"] +style = "blue bold" +symbol = "" +format = "[$output]($style) " diff --git a/.tmux.conf b/.tmux.conf index c80a6f3..50a6969 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -15,9 +15,13 @@ setw -q -g utf8 on bind - split-window -v -c "#{pane_current_path}" bind _ split-window -h -c "#{pane_current_path}" -# shift+arrow window switching -bind -n S-Left previous-window -bind -n S-Right next-window +# shift+arrow window switching (no wrap) +bind -n S-Left if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | head -1) ]" "previous-window" +bind -n S-Right if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | tail -1) ]" "next-window" + +# swap windows left/right with Ctrl+Shift+Arrow +bind-key -n C-S-Left swap-window -t -1\; select-window -t -1 +bind-key -n C-S-Right swap-window -t +1\; select-window -t +1 # sensible defaults set -s escape-time 10