sh: Add distrobox alias and enable displaying host
Add a simple alias to quickly use distrobox with `db` alias, and modify
pure prompt initialization slightly so that it displays a hostname when
in a distrobox container (akin to operating from ssh or normal container
usage).
HACKY implementation makes use of both an internal pure prompt api
(see here https://github.com/sindresorhus/pure/issues/585)
and a distrobox env var that I am not sure how exposed it is either.
Powerlevel10k uses a similar method though, so maybe it is fine
(see here 33916e91a7/internal/p10k.zsh (L8336)
).
This commit is contained in:
parent
99a3c0d314
commit
274cc8026a
2 changed files with 9 additions and 0 deletions
|
@ -119,3 +119,8 @@ elif exist ipython; then
|
|||
elif exist python; then
|
||||
alias py=python
|
||||
fi
|
||||
|
||||
# distrobox
|
||||
if exist distrobox; then
|
||||
alias db=distrobox
|
||||
fi
|
||||
|
|
|
@ -66,6 +66,10 @@ promptinit
|
|||
prompt_newline='%666v'
|
||||
# show git stash status as a ≡
|
||||
zstyle :prompt:pure:git:stash show yes
|
||||
# show hostname if we are in a distrobox environment
|
||||
if [ -n "$DISTROBOX_ENTER_PATH" ] && [ -f /run/.containerenv ]; then
|
||||
local container=lxc
|
||||
fi
|
||||
prompt pure
|
||||
|
||||
# shellcheck source=alias
|
||||
|
|
Loading…
Reference in a new issue