From 48a27f8c1ca2d9ac3c1b81d5715c9809b10dff6b Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 12 Aug 2024 18:01:54 +0200 Subject: [PATCH] zsh: themes: remove brethil-minimal, reabsorb into default theme --- README.md | 11 +++++++++-- themes/brethil-minimal.zsh-theme | 10 ---------- themes/brethil.zsh-theme | 11 +++++++++-- 3 files changed, 18 insertions(+), 14 deletions(-) delete mode 100644 themes/brethil-minimal.zsh-theme diff --git a/README.md b/README.md index ad2c2b5..62d4253 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,7 @@ My own dotfiles. `zsh` configuration based on [antidote](https://github.com/matt │ │     zsh plugins sourced by antidote ├──────── oh-my-zsh themes ──────── │ └── themes - │     ├─ brethil.zsh-theme - │     └─ brethil-minimal.zsh-theme + │     └─ brethil.zsh-theme ├──────── Misc rc files──────── │ ├── gitconfig │ │    └── git configuration @@ -96,3 +95,11 @@ Docker images are regularly built, and they include a full development environme ```bash docker run -it registry.decapod.one/brethil/dotfiles ``` + +## Theme customization + +To set a slightly more minimal prompt setup, the environment variable `DOTFILES_MINIMAL` can be set in `~/.zshrc` to reduce the space the path section of the prompt occupies, as well as removing the right prompt: + +```bash +export DOTFILES_MINIMAL=true +``` diff --git a/themes/brethil-minimal.zsh-theme b/themes/brethil-minimal.zsh-theme deleted file mode 100644 index 5a12f60..0000000 --- a/themes/brethil-minimal.zsh-theme +++ /dev/null @@ -1,10 +0,0 @@ -# vim:ft=zsh ts=2 sw=2 sts=2 - -local ret_status="%(?:%{$fg_bold[green]%}➜%{$reset_color%}:%{$fg[red]%}➜%{$reset_color%})" -local user="%(#:root@:)" -PROMPT='[%{$fg[red]%}${user}%M%{$reset_color%}][:%{$fg[green]%}%c%{$reset_color%}]$(git_prompt_info) ${ret_status} ' - -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}√%{$reset_color%}" diff --git a/themes/brethil.zsh-theme b/themes/brethil.zsh-theme index 4d9b74f..f074c69 100644 --- a/themes/brethil.zsh-theme +++ b/themes/brethil.zsh-theme @@ -27,7 +27,12 @@ else fi # Shows last 3 items in path if there are more than 4 -local path_prompt='[%F{green}%(4~:…/%3~:%~)%f]' +if [[ -n $DOTFILES_MINIMAL ]]; then + local path_prompt='[%F{green}%(4~:…/%3~:%~)%f]' +else + local path_prompt='[%F{green}%c%f]' +fi + # PREFIX/SUFFIX are added before/after `git_prompt_info` ZSH_THEME_GIT_PROMPT_PREFIX=" %f%{$fg[yellow]%} " @@ -95,4 +100,6 @@ export INSERT_MODE_INDICATOR="[%B%K{28}ins%k%b]" # green background # see https://github.com/zsh-users/zsh-autosuggestions/issues/570 for more information PROMPT='$(__virtualenv_info)'"${user_prompt}${path_prompt}${git_prompt}${job_prompt}${shlvl_prompt}$(__prompt_too_long)${prompt_with_previous_return_status}%{$(__print_prompt_marker)%} " # right prompt indicator: return code, vi mode prompt info and current time -RPS1="${return_code_RPS1}"'$(vi_mode_prompt_info)[%*]' +if [[ -z $DOTFILES_MINIMAL ]]; then + RPS1="${return_code_RPS1}"'$(vi_mode_prompt_info)[%*]' +fi