From f4af032bc359a09ea957d5a3fb7943d0c7beaeea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Tue, 7 Apr 2026 09:48:29 +0200 Subject: [PATCH 01/15] navi: Add docker compose commands --- navi/docker-compose.cheat | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/navi/docker-compose.cheat b/navi/docker-compose.cheat index 71d0eeb..268a13b 100644 --- a/navi/docker-compose.cheat +++ b/navi/docker-compose.cheat @@ -1,5 +1,8 @@ % docker-compose +# Build a compose YAML +sudo docker compose -f build + # Up a compose YAML sudo docker compose -f up @@ -12,10 +15,25 @@ sudo docker compose -f up -d --force-recreate # Down a compose YAML sudo docker compose -f down -# Print the last lines of compose YAML logs +# Execute command in a compose YAML +sudo docker compose -f exec + +# Print logs of a compose YAML sudo docker compose -f logs --tail 100 -# Print the last lines of compose YAML logs and following its logs +# Print service logs of a compose YAML +sudo docker compose -f logs --tail 100 + +# Print and follow logs of a compose YAML sudo docker compose -f logs --tail 100 -f +# Print and follow service logs of a compose YAML +sudo docker compose -f logs --tail 100 -f + +# Remove volume of a compose YAML +sudo docker volume rm _ + +$ dir: basename $PWD $ file: ls *.yaml | awk '{print $1}' +$ volume: sudo docker compose -f config --volumes | awk '{print $1}' +$ service: sudo docker compose -f config --services | awk '{print $1}' -- 2.54.0 From 0be57787e035c8001e7792cbc11e52666fccc137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Tue, 7 Apr 2026 09:48:41 +0200 Subject: [PATCH 02/15] navi: Add docker commands --- navi/docker.cheat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/navi/docker.cheat b/navi/docker.cheat index 6257e62..4e52f6f 100644 --- a/navi/docker.cheat +++ b/navi/docker.cheat @@ -14,11 +14,11 @@ $ volume: sudo docker volume ls --format "{{.Name}}" | awk '{print $1}' # Create new network docker network create -# List the networks +# List all networks sudo docker network ls -# Remove volume -sudo docker volume rm +# Remove network +sudo docker network rm $ network: sudo docker network ls --format "{{.Name}}" | awk '{print $1}' -- 2.54.0 From 5411dcfa355b247c81922b390a83e332699961b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Tue, 7 Apr 2026 09:49:25 +0200 Subject: [PATCH 03/15] navi: Rework replace commands --- navi/misc.cheat | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/navi/misc.cheat b/navi/misc.cheat index e7d784f..a7d308e 100644 --- a/navi/misc.cheat +++ b/navi/misc.cheat @@ -54,12 +54,18 @@ meld <(hexdump -C ) <(hexdump -C ) # Compare 2 files (bcompare) bcompare -# Replace expression in files -ack -rl "" | xargs sed -i 's###g' +# Replace expression in files (ack) +ack -rl '' | xargs sed -i 's###g' + +# Replace expression in files (rg) +rg -l '' | xargs sed -i 's###g' # Disable Bluetooth ERTM sudo bash -c "echo Y > /sys/module/bluetooth/parameters/disable_ertm" +# Show disk usage +df -h + $ user: cat /etc/passwd | awk -F: '{ print $1}' $ group: cat /etc/group | awk -F: '{ print $1}' $ interface: ip link | grep "^[0-9]*:" | sed "s/[0-9]*: \(.*\):.*/\1/" | awk -F: '{ print $1}' -- 2.54.0 From 981113b24c442e2274709900924bb3fda82d972c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Tue, 7 Apr 2026 09:49:38 +0200 Subject: [PATCH 04/15] navi: Improve compression commands --- navi/compression.cheat | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/navi/compression.cheat b/navi/compression.cheat index 8ecc8e0..d3abcb2 100644 --- a/navi/compression.cheat +++ b/navi/compression.cheat @@ -1,16 +1,34 @@ % compression # Create a tar archive -tar cf .tar +tar -cvf .tar + +# Create a tar archive (gz compression) +tar -cvzf .tar.gz + +# Create a tar archive (pigz compression) +tar -I pigz -cvf .tar.gz + +# Create a tar archive (bzip2 compression) +tar -cvjf .tar.bz2 + +# Create a tar archive (pbzip2 compression) +tar -I pbzip2 -cvf .tar.bz2 # Extract a tar archive -tar xf +tar -xf -# Create a tar archive with gz compression -tar czf .tar.gz +# Extract a tar (gz compression) +tar -xzf -# Extract a tar using gz compression -tar xzf +# Extract a tar (pigz compression) +tar -I pigz -xf + +# Extract a tar (bzip2 compression) +tar -xjf + +# Extract a tar (pbzip2 compression) +tar -I pbzip2 -xf # Create a gz archive gzip -9 -c > .gz @@ -21,4 +39,5 @@ gzip -d $ files: ls | awk -F: '{ print $1}' $ tar_file: ls *.tar | awk -F: '{ print $1}' $ targz_file: ls *.tar.gz | awk -F: '{ print $1}' +$ tarbz2_file: ls *.tar.bz2 | awk -F: '{ print $1}' $ gz_file: ls *.gz | awk -F: '{ print $1}' -- 2.54.0 From d1b621a4f8392581ddd909c4441067303e33e1ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Wed, 8 Apr 2026 17:06:58 +0200 Subject: [PATCH 05/15] navi: Add docker image commands --- navi/docker.cheat | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/navi/docker.cheat b/navi/docker.cheat index 4e52f6f..0781d78 100644 --- a/navi/docker.cheat +++ b/navi/docker.cheat @@ -3,24 +3,24 @@ # Create a volume sudo docker volume create +# Remove a volume +sudo docker volume rm + # List all volumes sudo docker volume ls -# Remove volume -sudo docker volume rm - -$ volume: sudo docker volume ls --format "{{.Name}}" | awk '{print $1}' +$ volume: sudo docker volume ls --format "{{.Name}}" | sort | awk '{print $1}' # Create new network -docker network create - -# List all networks -sudo docker network ls +sudo docker network create # Remove network sudo docker network rm -$ network: sudo docker network ls --format "{{.Name}}" | awk '{print $1}' +# List all networks +sudo docker network ls + +$ network: sudo docker network ls --format "{{.Name}}" | sort | awk '{print $1}' # List the running containers sudo docker ps @@ -43,4 +43,19 @@ sudo docker logs --tail 100 # Print the last lines of a container's logs and following its logs sudo docker logs --tail 100 -f -$ container: sudo docker container ls --format "{{.Names}}" | awk '{print $1}' +$ container: sudo docker container ls --format "{{.Names}}" | sort | awk '{print $1}' + +# List all images +sudo docker image ls + +# Remove an image +sudo docker image rm + +# Save an image into an archive +sudo docker image save -o + +# Load an image from an archive +sudo docker image load -i + +$ image: sudo docker image ls --format "{{.Repository}}:{{.Tag}}" | sort | awk '{print $1}' +$ archive: ls | awk '{print $1}' -- 2.54.0 From 302c10bd6c0df5d17035c6983ce3ec4bf6b22c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Mon, 27 Apr 2026 13:53:29 +0200 Subject: [PATCH 06/15] navi: Add git patch cheat sheets --- navi/git.cheat | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/navi/git.cheat b/navi/git.cheat index 7c66589..164e219 100644 --- a/navi/git.cheat +++ b/navi/git.cheat @@ -67,5 +67,30 @@ git push origin git tag -d git push -d origin +# Create a patch from current full diff +git diff > .patch + +# Create a patch from current file diff +git diff > .patch + +# Create a patch from commit(s) +git format-patch .. + +# Show a diff patch +git apply --stat + +# Check a diff patch +git apply --check + +# Apply a diff patch +git apply + +# Apply a commit patch +git am + # Variables $ tag_name: git tag -l | awk '{print $1}' +$ diff_file: git diff --name-only | awk '{print $1}' +$ first_commit: git log -n 20 --oneline | fzf --preview 'git show --color=always {1}' | awk '{print $1}' +$ last_commit: git log -n 20 --oneline | fzf --preview 'git show --color=always {1}' | awk '{print $1}' +$ patch_name: ls *.patch | awk '{print $1}' -- 2.54.0 From 8b4e8c99ad37bf04f03f86f0aa75bfbdf1b65806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Mon, 27 Apr 2026 13:53:42 +0200 Subject: [PATCH 07/15] navi: Fix git clean command --- navi/git.cheat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/navi/git.cheat b/navi/git.cheat index 164e219..522eb08 100644 --- a/navi/git.cheat +++ b/navi/git.cheat @@ -38,8 +38,8 @@ git push --set-upstream # Displays formatted log of commits for a repo git log --all --decorate --oneline --graph -# Clear everything -git clean -dxf +# Clean everything +git clean -fdx # Add a new module git submodule add -- 2.54.0 From ebabf1c529ec4dd4764cbcbae55aa6bc2b64db0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Mon, 27 Apr 2026 13:54:28 +0200 Subject: [PATCH 08/15] misc: Install cargo from source --- auto-config-cli.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auto-config-cli.sh b/auto-config-cli.sh index 28422b2..b8dec00 100755 --- a/auto-config-cli.sh +++ b/auto-config-cli.sh @@ -19,7 +19,7 @@ install_git_repo () { # Install packages sudo apt update sudo apt upgrade -sudo apt install minicom ssh git tig ack tree npm cargo python3-pip curl zsh +sudo apt install minicom ssh git tig ack tree npm python3-pip curl zsh # Install Oh my ZSH sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" @@ -57,6 +57,7 @@ install_git_repo https://github.com/junegunn/fzf.git $HOME/.fzf $HOME/.fzf/install # Install navi +curl https://sh.rustup.rs -sSf | sh cargo install navi mkdir -p $HOME/.local/share/navi/cheats ln -sfn $HOME/.dotfiles/navi/ $HOME/.local/share/navi/cheats/vulporuza -- 2.54.0 From 8ed785e03ca0c2ef3d3bba83a7446f67921836df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Mon, 27 Apr 2026 13:54:47 +0200 Subject: [PATCH 09/15] misc: Use ripgrep instead of ack --- auto-config-cli.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto-config-cli.sh b/auto-config-cli.sh index b8dec00..583dc07 100755 --- a/auto-config-cli.sh +++ b/auto-config-cli.sh @@ -19,7 +19,7 @@ install_git_repo () { # Install packages sudo apt update sudo apt upgrade -sudo apt install minicom ssh git tig ack tree npm python3-pip curl zsh +sudo apt install minicom ssh git tig ripgrep tree npm python3-pip curl zsh # Install Oh my ZSH sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -- 2.54.0 From b2b6d8b2ade4d2795819c2a92934e2e1c0ecce78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Thu, 10 Sep 2026 17:06:50 +0200 Subject: [PATCH 10/15] theme: Drop trailing % in RPS1 --- vulporuza.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vulporuza.zsh-theme b/vulporuza.zsh-theme index d8114ed..a352907 100644 --- a/vulporuza.zsh-theme +++ b/vulporuza.zsh-theme @@ -13,7 +13,7 @@ fi PS2='%{$fg[red]%}\ %{$reset_color%}' # Right prompt -RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%}) $FG[245]%n@%m%{$reset_color%}%' +RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%}) $FG[245]%n@%m%{$reset_color%}' # Git theme ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}[" -- 2.54.0 From b348ce9b35c5ae3039c4a42cac40db0a3d3cf391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Fri, 11 Sep 2026 10:00:01 +0200 Subject: [PATCH 11/15] theme: Add line break in PS1 --- vulporuza.zsh-theme | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vulporuza.zsh-theme b/vulporuza.zsh-theme index a352907..5ac6eea 100644 --- a/vulporuza.zsh-theme +++ b/vulporuza.zsh-theme @@ -4,10 +4,12 @@ typeset my_gray="$FG[240]" # Primary prompt if [ -z "${__GIT_PROMPT_DIR}" ]; then - PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%}╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_prompt_info) + PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%} +╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_prompt_info) ╰ %(!.#.») ' else - PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%}╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_super_status) + PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%} +╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_super_status) ╰ %(!.#.») ' fi PS2='%{$fg[red]%}\ %{$reset_color%}' -- 2.54.0 From 91d281c2ce87ba4e17239ec9402ed979c852785a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Fri, 11 Sep 2026 10:00:26 +0200 Subject: [PATCH 12/15] theme: Add virtualenv support --- .zshrc | 1 + vulporuza.zsh-theme | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.zshrc b/.zshrc index 56c628a..7d6ccfe 100644 --- a/.zshrc +++ b/.zshrc @@ -70,6 +70,7 @@ ZSH_THEME="vulporuza" # Add wisely, as too many plugins slow down shell startup. plugins=( gitfast + virtualenv zsh-syntax-highlighting zsh-autosuggestions # zsh-history-substring-search diff --git a/vulporuza.zsh-theme b/vulporuza.zsh-theme index 5ac6eea..fbbdfae 100644 --- a/vulporuza.zsh-theme +++ b/vulporuza.zsh-theme @@ -6,17 +6,21 @@ typeset my_gray="$FG[240]" if [ -z "${__GIT_PROMPT_DIR}" ]; then PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%} ╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_prompt_info) -╰ %(!.#.») ' +╰$(virtualenv_prompt_info) %(!.#.») ' else PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%} ╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_super_status) -╰ %(!.#.») ' +╰$(virtualenv_prompt_info) %(!.#.») ' fi PS2='%{$fg[red]%}\ %{$reset_color%}' # Right prompt RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%}) $FG[245]%n@%m%{$reset_color%}' +# Virtualenv (plugin virtualenv) +ZSH_THEME_VIRTUALENV_PREFIX=" %{$FG[075]%}(" +ZSH_THEME_VIRTUALENV_SUFFIX=")%{$reset_color%}" + # Git theme ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}[" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]" -- 2.54.0 From f2e7bb3714395155ad7737c6f77a5e8d29d050e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Fri, 11 Sep 2026 10:00:55 +0200 Subject: [PATCH 13/15] theme: Clean preexec / precmd functions --- vulporuza.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vulporuza.zsh-theme b/vulporuza.zsh-theme index fbbdfae..8ba7a7f 100644 --- a/vulporuza.zsh-theme +++ b/vulporuza.zsh-theme @@ -51,11 +51,11 @@ else fi function theme_preexec { - print -nr $'\e]2;'"$USER@$(hostname) » $PWD » $1 $2"$'\a' + print -nr $'\e]2;'"$USER@$HOST » $PWD » $1"$'\a' } add-zsh-hook preexec theme_preexec function theme_precmd { - print -nr $'\e]2;'"$USER@$(hostname) » $PWD"$'\a' + print -nr $'\e]2;'"$USER@$HOST » $PWD"$'\a' } add-zsh-hook precmd theme_precmd -- 2.54.0 From ebb8285300ba6112c9e2b24022650c964dced355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Fri, 11 Sep 2026 10:01:00 +0200 Subject: [PATCH 14/15] theme: Rework zsh-git-prompt exception --- vulporuza.zsh-theme | 74 +++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/vulporuza.zsh-theme b/vulporuza.zsh-theme index 8ba7a7f..0ba17aa 100644 --- a/vulporuza.zsh-theme +++ b/vulporuza.zsh-theme @@ -2,18 +2,29 @@ typeset my_gray="$FG[240]" -# Primary prompt -if [ -z "${__GIT_PROMPT_DIR}" ]; then - PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%} -╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_prompt_info) -╰$(virtualenv_prompt_info) %(!.#.») ' +# Optional widgets: zsh-git-prompt and virtualenv plugin may be missing. +if (( $+functions[git_super_status] )); then + _vulporuza_git='$(git_super_status)' else - PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%} -╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_super_status) -╰$(virtualenv_prompt_info) %(!.#.») ' + _vulporuza_git='$(git_prompt_info)' fi + +if (( $+functions[virtualenv_prompt_info] )); then + _vulporuza_venv='$(virtualenv_prompt_info)' +else + _vulporuza_venv='' +fi + +# Primary prompt +PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%} +╭ %T %{$FG[208]%}%~%{$reset_color%}'$_vulporuza_git' +╰'$_vulporuza_venv' %(!.#.») ' + PS2='%{$fg[red]%}\ %{$reset_color%}' +# Cleanup +unset _vulporuza_git _vulporuza_venv + # Right prompt RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%}) $FG[245]%n@%m%{$reset_color%}' @@ -25,37 +36,36 @@ ZSH_THEME_VIRTUALENV_SUFFIX=")%{$reset_color%}" ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}[" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]" -if [ -z "${__GIT_PROMPT_DIR}" ]; then - # git settings - ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}|%{$FG[034]%}✔" - ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}|%{$FG[075]%}…" +if (( $+functions[git_super_status] )); then + ZSH_THEME_GIT_PROMPT_HASH_PREFIX=":" + ZSH_THEME_GIT_PROMPT_SEPARATOR="|" + ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}" + ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%1G%}" + ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%1G%}" + ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%1G%}" + ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%1G%}" + ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%1G%}" + ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%1G%}" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%1G%}" + ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%1G%}" + ZSH_THEME_GIT_PROMPT_LOCAL=" L" + # The remote branch will be shown between these two + ZSH_THEME_GIT_PROMPT_UPSTREAM_FRONT=" {%{$fg[blue]%}" + ZSH_THEME_GIT_PROMPT_UPSTREAM_END="%{${reset_color}%}}" + ZSH_THEME_GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}|MERGING%{${reset_color}%}" + ZSH_THEME_GIT_PROMPT_REBASE="%{$fg_bold[magenta]%}|REBASE%{${reset_color}%} " + ZSH_THEME_GIT_PROMPT_BISECT="%{$fg_bold[magenta]%}|BISECT%{${reset_color}%} " else - ZSH_THEME_GIT_PROMPT_HASH_PREFIX=":" - ZSH_THEME_GIT_PROMPT_SEPARATOR="|" - ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}" - ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%1G%}" - ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%1G%}" - ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%1G%}" - ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%1G%}" - ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%1G%}" - ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%1G%}" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%1G%}" - ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%1G%}" - ZSH_THEME_GIT_PROMPT_LOCAL=" L" - # The remote branch will be shown between these two - ZSH_THEME_GIT_PROMPT_UPSTREAM_FRONT=" {%{$fg[blue]%}" - ZSH_THEME_GIT_PROMPT_UPSTREAM_END="%{${reset_color}%}}" - ZSH_THEME_GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}|MERGING%{${reset_color}%}" - ZSH_THEME_GIT_PROMPT_REBASE="%{$fg_bold[magenta]%}|REBASE%{${reset_color}%} " - ZSH_THEME_GIT_PROMPT_BISECT="%{$fg_bold[magenta]%}|BISECT%{${reset_color}%} " + ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}|%{$FG[034]%}✔" + ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}|%{$FG[075]%}…" fi function theme_preexec { - print -nr $'\e]2;'"$USER@$HOST » $PWD » $1"$'\a' + print -nr $'\e]2;'"$USER@$HOST » $PWD » $1"$'\a' } add-zsh-hook preexec theme_preexec function theme_precmd { - print -nr $'\e]2;'"$USER@$HOST » $PWD"$'\a' + print -nr $'\e]2;'"$USER@$HOST » $PWD"$'\a' } add-zsh-hook precmd theme_precmd -- 2.54.0 From e354721927a3aa6b9b039599f666544a5c02b0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Thu, 10 Sep 2026 21:28:23 +0200 Subject: [PATCH 15/15] theme: Add color palettes --- .zshrc | 3 + vulporuza-palettes.zsh | 123 +++++++++++++++++++++++++++++++++++++++++ vulporuza.zsh-theme | 53 ++++++++++-------- 3 files changed, 157 insertions(+), 22 deletions(-) create mode 100644 vulporuza-palettes.zsh diff --git a/.zshrc b/.zshrc index 7d6ccfe..4fc1d10 100644 --- a/.zshrc +++ b/.zshrc @@ -10,6 +10,9 @@ export ZSH="$HOME/.oh-my-zsh" # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes ZSH_THEME="vulporuza" +# Palettes: ~/.dotfiles/vulporuza-palettes.zsh +VULPORUZA_PALETTE=vuru + # Set list of themes to pick from when loading at random # Setting this variable when ZSH_THEME=random will cause zsh to load # a theme from this variable instead of looking in $ZSH/themes/ diff --git a/vulporuza-palettes.zsh b/vulporuza-palettes.zsh new file mode 100644 index 0000000..3030deb --- /dev/null +++ b/vulporuza-palettes.zsh @@ -0,0 +1,123 @@ +# vulporuza-palettes.zsh +# Sourced by vulporuza.zsh-theme. Requires Oh My Zsh spectrum ($FG) and colors. +# +# Select one with VULPORUZA_PALETTE in ~/.zshrc (before Oh My Zsh): +# vuru | fox | frost | tokyo | quiet + +typeset -ga _vulporuza_keys +_vulporuza_keys=( + dash path branch venv host dirty clean + staged conflicts changed untracked stashed + upstream state error +) + +typeset -gA _vulporuza_p_vuru +_vulporuza_p_vuru=( + dash "$FG[240]" + path "$FG[208]" + branch "%{$fg_bold[magenta]%}" + venv "$FG[075]" + host "$FG[245]" + dirty "$FG[075]" + clean "$FG[034]" + staged "%{$fg[red]%}" + conflicts "%{$fg[red]%}" + changed "%{$fg[blue]%}" + untracked "%{$fg[cyan]%}" + stashed "%{$fg_bold[blue]%}" + upstream "%{$fg[blue]%}" + state "%{$fg_bold[magenta]%}" + error "%{$fg[red]%}" +) + +typeset -gA _vulporuza_p_fox +_vulporuza_p_fox=( + dash "$FG[236]" + path "$FG[166]" + branch "$FG[180]" + venv "$FG[073]" + host "$FG[240]" + dirty "$FG[172]" + clean "$FG[107]" + staged "$FG[167]" + conflicts "$FG[167]" + changed "$FG[109]" + untracked "$FG[080]" + stashed "$FG[110]" + upstream "$FG[109]" + state "$FG[180]" + error "$FG[167]" +) + +typeset -gA _vulporuza_p_frost +_vulporuza_p_frost=( + dash "$FG[237]" + path "$FG[109]" + branch "$FG[110]" + venv "$FG[108]" + host "$FG[243]" + dirty "$FG[173]" + clean "$FG[114]" + staged "$FG[167]" + conflicts "$FG[167]" + changed "$FG[109]" + untracked "$FG[080]" + stashed "$FG[110]" + upstream "$FG[110]" + state "$FG[139]" + error "$FG[167]" +) + +typeset -gA _vulporuza_p_tokyo +_vulporuza_p_tokyo=( + dash "$FG[237]" + path "$FG[111]" + branch "$FG[141]" + venv "$FG[080]" + host "$FG[242]" + dirty "$FG[215]" + clean "$FG[114]" + staged "$FG[167]" + conflicts "$FG[167]" + changed "$FG[109]" + untracked "$FG[087]" + stashed "$FG[110]" + upstream "$FG[111]" + state "$FG[141]" + error "$FG[167]" +) + +typeset -gA _vulporuza_p_quiet +_vulporuza_p_quiet=( + dash "$FG[238]" + path "$FG[208]" + branch "$FG[250]" + venv "$FG[244]" + host "$FG[240]" + dirty "$FG[244]" + clean "$FG[034]" + staged "$FG[167]" + conflicts "$FG[167]" + changed "$FG[109]" + untracked "$FG[080]" + stashed "$FG[110]" + upstream "$FG[244]" + state "$FG[250]" + error "$FG[167]" +) + +_vulporuza_apply_palette() { + emulate -L zsh + local name=${VULPORUZA_PALETTE:-vuru} + if ! (( ${+parameters[_vulporuza_p_$name]} )); then + print -u2 "vulporuza: unknown VULPORUZA_PALETTE '${name}', using vuru" + name=vuru + VULPORUZA_PALETTE=vuru + fi + typeset -gA _vulporuza + _vulporuza=() + local key + for key in "${_vulporuza_keys[@]}"; do + eval "_vulporuza[\$key]=\${_vulporuza_p_${name}[\$key]}" + done +} diff --git a/vulporuza.zsh-theme b/vulporuza.zsh-theme index 0ba17aa..953b4fd 100644 --- a/vulporuza.zsh-theme +++ b/vulporuza.zsh-theme @@ -1,6 +1,17 @@ # vulporuza.zsh-theme +# +# Palette: set VULPORUZA_PALETTE in ~/.zshrc before Oh My Zsh. +# Definitions: vulporuza-palettes.zsh (same directory). -typeset my_gray="$FG[240]" +typeset _vulporuza_dir="${${(%):-%x}:A:h}" +if ! source "${_vulporuza_dir}/vulporuza-palettes.zsh"; then + print -u2 "vulporuza: missing ${_vulporuza_dir}/vulporuza-palettes.zsh" + unset _vulporuza_dir + return +fi +unset _vulporuza_dir + +_vulporuza_apply_palette # Optional widgets: zsh-git-prompt and virtualenv plugin may be missing. if (( $+functions[git_super_status] )); then @@ -16,48 +27,46 @@ else fi # Primary prompt -PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%} -╭ %T %{$FG[208]%}%~%{$reset_color%}'$_vulporuza_git' +PS1='${_vulporuza[dash]}${(r:$COLUMNS::-:)}%{$reset_color%} +╭ %T ${_vulporuza[path]}%~%{$reset_color%}'$_vulporuza_git' ╰'$_vulporuza_venv' %(!.#.») ' -PS2='%{$fg[red]%}\ %{$reset_color%}' +PS2='${_vulporuza[error]}\ %{$reset_color%}' -# Cleanup unset _vulporuza_git _vulporuza_venv # Right prompt -RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%}) $FG[245]%n@%m%{$reset_color%}' +RPS1='%(?..${_vulporuza[error]}%? ↵%{$reset_color%}) ${_vulporuza[host]}%n@%m%{$reset_color%}' # Virtualenv (plugin virtualenv) -ZSH_THEME_VIRTUALENV_PREFIX=" %{$FG[075]%}(" +ZSH_THEME_VIRTUALENV_PREFIX=" ${_vulporuza[venv]}(" ZSH_THEME_VIRTUALENV_SUFFIX=")%{$reset_color%}" -# Git theme +# Git: shared wrapper ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}[" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]" if (( $+functions[git_super_status] )); then ZSH_THEME_GIT_PROMPT_HASH_PREFIX=":" ZSH_THEME_GIT_PROMPT_SEPARATOR="|" - ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}" - ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%1G%}" - ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%1G%}" - ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%1G%}" + ZSH_THEME_GIT_PROMPT_BRANCH="${_vulporuza[branch]}" + ZSH_THEME_GIT_PROMPT_STAGED="${_vulporuza[staged]}%{●%1G%}" + ZSH_THEME_GIT_PROMPT_CONFLICTS="${_vulporuza[conflicts]}%{✖%1G%}" + ZSH_THEME_GIT_PROMPT_CHANGED="${_vulporuza[changed]}%{✚%1G%}" ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%1G%}" ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%1G%}" - ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%1G%}" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%1G%}" - ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%1G%}" + ZSH_THEME_GIT_PROMPT_STASHED="${_vulporuza[stashed]}%{⚑%1G%}" + ZSH_THEME_GIT_PROMPT_UNTRACKED="${_vulporuza[untracked]}%{…%1G%}" + ZSH_THEME_GIT_PROMPT_CLEAN="${_vulporuza[clean]}%{✔%1G%}" ZSH_THEME_GIT_PROMPT_LOCAL=" L" - # The remote branch will be shown between these two - ZSH_THEME_GIT_PROMPT_UPSTREAM_FRONT=" {%{$fg[blue]%}" + ZSH_THEME_GIT_PROMPT_UPSTREAM_FRONT=" {${_vulporuza[upstream]}" ZSH_THEME_GIT_PROMPT_UPSTREAM_END="%{${reset_color}%}}" - ZSH_THEME_GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}|MERGING%{${reset_color}%}" - ZSH_THEME_GIT_PROMPT_REBASE="%{$fg_bold[magenta]%}|REBASE%{${reset_color}%} " - ZSH_THEME_GIT_PROMPT_BISECT="%{$fg_bold[magenta]%}|BISECT%{${reset_color}%} " + ZSH_THEME_GIT_PROMPT_MERGING="${_vulporuza[state]}|MERGING%{${reset_color}%}" + ZSH_THEME_GIT_PROMPT_REBASE="${_vulporuza[state]}|REBASE%{${reset_color}%} " + ZSH_THEME_GIT_PROMPT_BISECT="${_vulporuza[state]}|BISECT%{${reset_color}%} " else - ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}|%{$FG[034]%}✔" - ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}|%{$FG[075]%}…" + ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}|${_vulporuza[clean]}✔" + ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}|${_vulporuza[dirty]}…" fi function theme_preexec { -- 2.54.0