Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
366a895a08
|
||
|
|
7ceef4775c |
@@ -23,6 +23,35 @@
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# Unlike oh-my-zsh.extraConfig above, this lands *after*
|
||||
# `source $ZSH/oh-my-zsh.sh`, which is where the theme's prompt functions
|
||||
# come into existence.
|
||||
initContent = lib.mkAfter ''
|
||||
# Keep the prompt on one line in deeply nested trees.
|
||||
#
|
||||
# Both themes render the working directory as `%~`, the full path with
|
||||
# $HOME collapsed to `~`. Somewhere like
|
||||
# ~/git/bfh/cas-pml-sem/documents/bericht that is 39 columns on its own,
|
||||
# and together with user@host and a long branch name the line wraps.
|
||||
#
|
||||
# `%(4~|…/%2~|%~)` is a prompt ternary: at four or more components show
|
||||
# an ellipsis and the last two, otherwise show the path whole. Short
|
||||
# paths like ~/git/nixconfig are left alone.
|
||||
if [[ "$ZSH_THEME" == "agnoster" ]]; then
|
||||
# agnoster calls prompt_dir on every render, so redefining it is
|
||||
# enough. AGNOSTER_DIR_* keep the segment's own colours.
|
||||
prompt_dir() {
|
||||
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" '%(4~|…/%2~|%~)'
|
||||
}
|
||||
else
|
||||
# gentoo builds PROMPT once at load time, so patch the string. Its
|
||||
# `%~` is the non-root branch of `%(!.%1~.%~)`, and it is the first
|
||||
# literal `%~` in there, so the root branch is untouched. ASCII `...`
|
||||
# because this branch is the Linux console, whose font may lack U+2026.
|
||||
PROMPT="''${PROMPT/\%~/%(4~|.../%2~|%~)}"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# set important env vars
|
||||
|
||||
Reference in New Issue
Block a user