# fnm (Fast Node Manager) configuration # https://github.com/Schniz/fnm # Check if fnm is installed if command -v fnm &> /dev/null; then # Set fnm environment variables and enable auto-switching on directory change eval "$(fnm env --use-on-cd --shell zsh)" # Enable fnm completions for zsh eval "$(fnm completions --shell zsh)" # Optional: Auto-install Node.js version if .node-version exists but version not installed # Uncomment the following lines to enable this feature: # autoload -U add-zsh-hook # _fnm_autoinstall() { # if [[ -f .node-version || -f .nvmrc ]]; then # local version # if [[ -f .node-version ]]; then # version="$(cat .node-version)" # elif [[ -f .nvmrc ]]; then # version="$(cat .nvmrc)" # fi # if ! fnm list | grep -q "$version"; then # echo "Auto-installing Node.js $version..." # fnm install "$version" # fi # fi # } # add-zsh-hook chpwd _fnm_autoinstall # _fnm_autoinstall # Run on shell startup fi