From d6687d8fa436ebbc37af1d63245588e17bb17ac4 Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Mon, 26 Sep 2022 18:39:41 -0400 Subject: [PATCH] Single repo + chezmoi status in oh-my-posh prompt Oh-My-Posh prompt displaying chezmoi status when changes are in working copy (home dir) and/or uncommitted changes in the source path. Externals manages as a separate chezmoi source in a subdir of the source repo. --- _externals/.chezmoiexternal.toml | 85 +++++++++++++++++++ _externals/.chezmoiignore | 3 + _externals/private_dot_config/.keep | 0 .../private_share/private_fonts/.keep | 0 _home/.chezmoiexternal.toml | 4 - _home/dot_sz.shrc.d/97_chezmoi_aliases | 8 +- _home/private_dot_poshtheme.omp.json | 18 ++++ 7 files changed, 110 insertions(+), 8 deletions(-) create mode 100644 _externals/.chezmoiexternal.toml create mode 100644 _externals/.chezmoiignore create mode 100644 _externals/private_dot_config/.keep create mode 100644 _externals/private_dot_local/private_share/private_fonts/.keep delete mode 100644 _home/.chezmoiexternal.toml diff --git a/_externals/.chezmoiexternal.toml b/_externals/.chezmoiexternal.toml new file mode 100644 index 0000000..aa2d9c6 --- /dev/null +++ b/_externals/.chezmoiexternal.toml @@ -0,0 +1,85 @@ +{{ if eq .chezmoi.hostname "pqb-laptop" }} +[".local/share/git-on-web/chemacs2"] + type = "git-repo" + url = "https://github.com/plexus/chemacs2.git" + refreshPeriod = "168h" # 7 days + +[".config/_my.emacs/spacemacs/emacs.d"] + type = "git-repo" + url = "https://github.com/syl20bnr/spacemacs.git" + clone.args = ["--depth=1","--branch=develop","--single-branch"] + refreshPeriod = "168h" # 7 days + +[".config/_my.emacs/doom/emacs.d"] + type = "git-repo" + url = "https://github.com/doomemacs/doomemacs" + clone.args = ["--depth=1","--branch=develop","--single-branch"] + refreshPeriod = "168h" # 7 days +{{ end }} + +# ["my/code/from_web/nerd-fonts"] +# type = "git-repo" +# url = "https://github.com/ryanoasis/nerd-fonts.git" +# clone.args = ["--depth=1"] +# refreshPeriod = "168h" # 7 days + +[".local/share/bash-completion/tmux"] + type = "git-repo" + url = "https://github.com/imomaliev/tmux-bash-completion" + clone.args = ["--depth=1","--single-branch"] + refreshPeriod = "168h" # 7 days + +[".local/share/fonts/NF_CodeNewRoman"] + type = "archive" +# url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/CodeNewRoman.zip" + url = "https://github.com/ryanoasis/nerd-fonts/releases/download/2.2.0-RC/CodeNewRoman.zip" + exact = true + refreshPeriod = "168h" # 7 days + +[".local/share/fonts/NF_FiraCode"] + type = "archive" +# url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip" + url = "https://github.com/ryanoasis/nerd-fonts/releases/download/2.2.0-RC/FiraCode.zip" + exact = true + refreshPeriod = "168h" # 7 days + +[".local/bin/oh-my-posh"] + type = "file" + url = "https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64" + executable = true + +[".poshthemes"] + type = "archive" + url = "https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip" + exact = true + refreshPeriod = "168h" # 7 days + +[".config/Code/Dictionaries/English (American).dic"] + type = "file" + url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/English%20(American).dic" + refreshPeriod = "168h" # 7 days + +[".config/Code/Dictionaries/English (American).aff"] + type = "file" + url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/English%20(American).aff" + refreshPeriod = "168h" # 7 days + +[".config/Code/Dictionaries/English (American).txt"] + type = "file" + url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/English%20(American).txt" + refreshPeriod = "168h" # 7 days + +[".config/Code/Dictionaries/Hebrew (Israel).dic"] + type = "file" + url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/Hebrew%20(Israel).dic" + refreshPeriod = "168h" # 7 days + +[".config/Code/Dictionaries/Hebrew (Israel).aff"] + type = "file" + url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/Hebrew%20(Israel).aff" + refreshPeriod = "168h" # 7 days + +[".config/Code/Dictionaries/Hebrew (Israel).txt"] + type = "file" + url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/Hebrew%20(Israel).txt" + refreshPeriod = "168h" # 7 days diff --git a/_externals/.chezmoiignore b/_externals/.chezmoiignore new file mode 100644 index 0000000..1d45812 --- /dev/null +++ b/_externals/.chezmoiignore @@ -0,0 +1,3 @@ +.local/share/fonts/**/.uuid +.ssh/* +~.ssh/authorized_keys.template diff --git a/_externals/private_dot_config/.keep b/_externals/private_dot_config/.keep new file mode 100644 index 0000000..e69de29 diff --git a/_externals/private_dot_local/private_share/private_fonts/.keep b/_externals/private_dot_local/private_share/private_fonts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/_home/.chezmoiexternal.toml b/_home/.chezmoiexternal.toml deleted file mode 100644 index 31be46d..0000000 --- a/_home/.chezmoiexternal.toml +++ /dev/null @@ -1,4 +0,0 @@ -[".local/share/chezmoi.externals"] - type = "git-repo" - url = "https://code.lksz.me/lksz/dotfiles.chezmoi.externals.git" - refreshPeriod = "168h" # 7 days diff --git a/_home/dot_sz.shrc.d/97_chezmoi_aliases b/_home/dot_sz.shrc.d/97_chezmoi_aliases index c4d3bf4..71f35c0 100644 --- a/_home/dot_sz.shrc.d/97_chezmoi_aliases +++ b/_home/dot_sz.shrc.d/97_chezmoi_aliases @@ -1,13 +1,13 @@ if [[ -n "$(which-command chezmoi)" ]]; then - export CZ="$(chezmoi source-path)" - export CZ_X="$CZ.externals" - export CHEZMOIROOT="$CZ" + export CHEZMOIROOT="$(chezmoi source-path)" + export CZ="$CHEZMOIROOT/_home" + export CZ_X="$CHEZMOIROOT/_externals" alias czcd="cd $CZ" alias czxcd="cd $CZ_X" alias cz="chezmoi " - alias czx="chezmoi --source $CZ_X --config $HOME/.config/chezmoi.externals/chezmoi.toml " + alias czx="chezmoi --source $CZ_X --config $HOME/.config/chezmoi/chezmoi.externals.toml " alias czs="cz status " diff --git a/_home/private_dot_poshtheme.omp.json b/_home/private_dot_poshtheme.omp.json index 08017b1..89d46a7 100644 --- a/_home/private_dot_poshtheme.omp.json +++ b/_home/private_dot_poshtheme.omp.json @@ -287,6 +287,24 @@ "template": "{{ if gt .Code 0 }}{{ .Meaning }}{{ else }}✔{{ end }} ", "type": "exit" }, + { + "type": "command", + "foreground": "", + "foreground_templates": [ + "{{ if eq .Output \"0,0\" }}#DD7700{{else}}#d3d7cf{{ end }}" + ], + "background_templates": [ + "{{ if eq .Output \"0,0\" }}#000000{{else}}#DD7700{{ end }}" + ], + "powerline_symbol": "", + "invert_powerline": true, + "style": "powerline", + "properties": { + "shell": "bash", + "command": "type -t chezmoi 2>&1 >/dev/null && printf \"%s\" $(chezmoi status 2>/dev/null | wc -l) , $(chezmoi git -- status --short | wc -l)" + }, + "template": "{{ if ne .Output \"0,0\" }}≢{{ .Output }}{{ end }}" + }, { "background": "#4063D8", "background_templates": [