I'm not too versed with the terminal. I'm using zsh with prezto and I wanted to show the node version in the prompt. At the prezto repo they provide these instructions: https://github.com/sorin-ionescu/prezto/tree/master/modules/node
And I can follow up to the last part:
Then add $node_info[version] to either $PROMPT or $RPROMPT and call node-info in prompt_name_preexec hook function.
I added $node_info[version] to the $PROMPT in my theme file, but what does it mean to call node-info in the prompt_name_preexec hook? is that a function inside my theme file? I honestly have no clue what is talking about.
Thanks!
There are multiple files associated with
Zshprompt themes, Likeprompt_name_setup,prompt_name_preview,prompt_name_help,prompt_name_preexec. Onlyprompt_name_setupis required and others are optional, These files are stored somewhere in$fpath. Replace thatnamewith your current prompt theme (prompt -c).To show your
nodeversion inprezto, Add the following to yourprompt_name_setup.Create if you don't have a file named
prompt_name_preexecin your$fpathor add this to it asPROMPTorRPROMPTvariable.After reloading your terminal, Verify its added by
echo $PROMPTorecho $RPROMPT.If you don't want any of the hassle and want to show
nodeversion in your prompt, Use a prompt theme like spaceship-prompt (Disclaimer: I'm one of the maintainer)