aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorStefan Weigl-Bosker <stefan@s00.xyz>2025-03-06 12:10:10 -0500
committerStefan Weigl-Bosker <stefan@s00.xyz>2025-03-06 12:10:10 -0500
commit8a0ea10b75a465025ba5430d586ae6589f0ea36f (patch)
treea616956590b0de24a440e982b37f7c7f65932d60 /modules
parentbaedef6e4bef3b4ddbb9fe0c6b00dc160ddedc83 (diff)
downloadhome-8a0ea10b75a465025ba5430d586ae6589f0ea36f.tar.gz
ditch omz
Diffstat (limited to 'modules')
-rw-r--r--modules/gpg/default.nix16
-rw-r--r--modules/zsh/default.nix12
-rw-r--r--modules/zsh/themes/stefan.zsh-theme65
3 files changed, 88 insertions, 5 deletions
diff --git a/modules/gpg/default.nix b/modules/gpg/default.nix
index 85682b6..37e8b04 100644
--- a/modules/gpg/default.nix
+++ b/modules/gpg/default.nix
@@ -21,5 +21,21 @@ in
pinentryPackage = pkgs.pinentry-qt;
# sshKeys = [ "36663E191B00E51513F90FA5CF2BCE8461C297CD" ];
};
+
+ home.file.".gnupg/pinentry-dmenu.conf" = {
+ text = ''
+ asterisk= "";
+ prompt = "";
+ font = "ComicShannsMono Nerd Font Mono:size=13";
+ prompt_fg = "#cacaca";
+ prompt_bg = "#0d0d0d";
+ normal_fg = "#4c4c4c";
+ normal_bg = "#0d0d0d";
+ select_fg = "#8aac8b";
+ select_bg = "#0d0d0d";
+ desc_fg = "#cacaca";
+ desc_bg = "#0d0d0d";
+ '';
+ };
};
}
diff --git a/modules/zsh/default.nix b/modules/zsh/default.nix
index b1ed82e..0c7adeb 100644
--- a/modules/zsh/default.nix
+++ b/modules/zsh/default.nix
@@ -17,10 +17,11 @@ in
config = mkIf cfg.enable {
home.packages = with pkgs; [
zsh
- oh-my-zsh
zsh-autosuggestions
+ gitstatus
];
+ # omz isn't actually used, directory is arbitrary
home.file.".oh-my-zsh/themes" = {
source = ./themes;
recursive = true;
@@ -28,11 +29,14 @@ in
programs.zsh = {
enable = true;
+ autocd = true;
enableCompletion = true;
- autosuggestion.enable = true;
- oh-my-zsh = {
- enable = true;
+ dirHashes = {
+ home = "~/home";
+ dl = "~/dl";
+ src = "~/src";
};
+ autosuggestion.enable = true;
initExtra = ''
source ~/.oh-my-zsh/themes/${cfg.theme}.zsh-theme
'';
diff --git a/modules/zsh/themes/stefan.zsh-theme b/modules/zsh/themes/stefan.zsh-theme
index 4d71d9c..788f49b 100644
--- a/modules/zsh/themes/stefan.zsh-theme
+++ b/modules/zsh/themes/stefan.zsh-theme
@@ -2,8 +2,71 @@ function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
}
+function gitstatus_prompt_update() {
+ typeset -g GITSTATUS_PROMPT=''
+ local p
+
+ gitstatus_query 'MY' || return 1 # we could use -c to do async
+ [[ $VCS_STATUS_RESULT == 'ok-sync' ]] || return 0 # not in a repo
+
+
+ local green='%{%F{green}%}'
+ local red='%{%F{red}%}'
+ local yellow='%{%F{yellow}%}'
+ local blue='%{%F{blue}%}'
+
+ local name
+ if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
+ name=$VCS_STATUS_LOCAL_BRANCH
+ elif [[ -n $VCS_STATUS_TAG ]]; then
+ p+='%f#'
+ name="${VCS_STATUS_TAG}"
+ else
+ p+='%f@'
+ name="#${VCS_STATUS_COMMIT[1,8]}"
+ fi
+
+ (( $#name > 32 )) && name[13,-13]="…" # truncate long branch names and tags
+ p+="${green}${name//\%/%%}" # escape %
+
+ # ⇣42 if behind the remote.
+ (( VCS_STATUS_COMMITS_BEHIND )) && p+=" ${green}⇣${VCS_STATUS_COMMITS_BEHIND}"
+ # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42.
+ (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && p+=" "
+ (( VCS_STATUS_COMMITS_AHEAD )) && p+="${green}⇡${VCS_STATUS_COMMITS_AHEAD}"
+ # ⇠42 if behind the push remote.
+ (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && p+=" ${green}⇠${VCS_STATUS_PUSH_COMMITS_BEHIND}"
+ (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && p+=" "
+ # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42.
+ (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && p+="${green}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}"
+ # *42 if have stashes.
+ (( VCS_STATUS_STASHES )) && p+=" ${green}*${VCS_STATUS_STASHES}"
+ # 'merge' if the repo is in an unusual state.
+ [[ -n $VCS_STATUS_ACTION ]] && p+=" ${red}${VCS_STATUS_ACTION}"
+ # ~42 if have merge conflicts.
+ (( VCS_STATUS_NUM_CONFLICTED )) && p+=" ${red}~${VCS_STATUS_NUM_CONFLICTED}"
+ # +42 if have staged changes.
+ (( VCS_STATUS_NUM_STAGED )) && p+=" ${yellow}+${VCS_STATUS_NUM_STAGED}"
+ # !42 if have unstaged changes.
+ (( VCS_STATUS_NUM_UNSTAGED )) && p+=" ${yellow}!${VCS_STATUS_NUM_UNSTAGED}"
+ # ?42 if have untracked files. It's really a question mark, your font isn't broken.
+ (( VCS_STATUS_NUM_UNTRACKED )) && p+=" ${blue}?${VCS_STATUS_NUM_UNTRACKED}"
+
+ GITSTATUS_PROMPT="%f${p}%f"
+}
+
+source "$(gitstatus-share)/gitstatus.plugin.zsh" || return
+
+gitstatus_stop 'MY' && gitstatus_start -s -1 -u -1 -c -1 -d -1 'MY'
+
+autoload -Uz add-zsh-hook
+add-zsh-hook precmd gitstatus_prompt_update
+
+setopt prompt_subst prompt_percent no_prompt_bang
+
NEWLINE=$'\n'
+GIT_PROMPT_INFO=${GITSTATUS_PROMPT:+ $GITSTATUS_PROMPT}
PROMPT="%F{magenta}%~% %f% %F{yellow}% ${NEWLINE}λ %b%f%"
-RPROMPT='$(virtualenv_info)% $(git_prompt_info)'
+RPROMPT='$(virtualenv_info)% ${GITSTATUS_PROMPT:+ $GITSTATUS_PROMPT}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"