Support FNM (NVM replacement) and bun

This commit is contained in:
Alexander Gehrke 2025-09-19 16:22:54 +02:00 committed by Alexander Roso
parent 21e41141ef
commit 67c760dc6e
3 changed files with 53 additions and 28 deletions

4
env/50_bun.zsh vendored Normal file
View file

@ -0,0 +1,4 @@
export BUN_INSTALL="$HOME/.local/share/bun"
if [[ -d $BUN_INSTALL ]]; then
path+="$BUN_INSTALL/bin"
fi

View file

@ -1,15 +1,23 @@
typeset -a chpwd_functions __chromaz_extra_left typeset -a chpwd_functions __chromaz_extra_left
# fnm
FNM_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/fnm"
if [ -d "$FNM_PATH" ]; then
export PATH="$FNM_PATH:$PATH"
eval "$(fnm env --use-on-cd --version-file-strategy recursive)"
FNM_DEFAULT=${$(readlink $FNM_PATH/aliases/default):h:t}
_prompt_fnm_version() {
local node_version=$(fnm current)
[[ $node_version == $FNM_DEFAULT ]] && return
echo "nodejs: ${node_version}"
}
__chromaz_extra_left+=_prompt_fnm_version
elif [ -d "$HOME/.nvm" ]; then
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
nvm() { nvm() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm "$@" nvm "$@"
} }
_prompt_nvm_version() {
[[ -z $NVM_BIN ]] && return
echo "nvm: ${NVM_BIN:h:t}"
}
__chromaz_extra_left+=_prompt_nvm_version
find-nvmrc-version() { find-nvmrc-version() {
local dir=${1:-${PWD:a}} local dir=${1:-${PWD:a}}
@ -31,3 +39,13 @@ chpwd-set-nvm() {
chpwd-set-nvm &>/dev/null chpwd-set-nvm &>/dev/null
chpwd_functions+=chpwd-set-nvm chpwd_functions+=chpwd-set-nvm
_prompt_nvm_version() {
[[ -z $NVM_BIN ]] && return
echo "nodejs: ${NVM_BIN:h:t}"
}
__chromaz_extra_left+=_prompt_nvm_version
else
return
fi

3
zshrc
View file

@ -130,3 +130,6 @@ fi
tabs -4 tabs -4
#zprof #zprof
# bun completions
[ -s "/home/crater2150/.bun/_bun" ] && source "/home/crater2150/.bun/_bun"