Closed madpipeline closed 4 years ago
While I'm generally in favor of showing the Node version only in directories with a package.json
present and was gonna implement that myself as well (with an option ofc), to disable it entirely, you should just remove the nvm
entry from BULLETTRAIN_PROMPT_ORDER
.
Please feel free to extend my implementation for that. I don't use NVM, so for me it's just throwing errors that it can't find it.
Sâm, 26 oct. 2019, 19:32 FallenWarrior2k notifications@github.com a scris:
While I'm generally a favor of showing the Node version only in directories with a package.json present and was gonna implement that myself as well (with an option ofc), to disable it entirely, you should just remove the nvm entry from BULLETTRAIN_PROMPT_ORDER.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/caiogondim/bullet-train.zsh/pull/304?email_source=notifications&email_token=AA25G3V373DEQIXT6BLCCLLQQRWLDA5CNFSM4GQZ6KRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKLXVQ#issuecomment-546618326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA25G3R542IMZ2ZGM63UUQTQQRWLDANCNFSM4GQZ6KRA .
I'm sorry, I should've been clearer.
BULLETTRAIN_PROMPT_ORDER
is a variable you, the user, set somewhere in your zshrc or its include hierarchy.
It's default value, as seen here is
BULLETTRAIN_PROMPT_ORDER=(
time
status
custom
context
dir
screen
perl
ruby
virtualenv
nvm
aws
go
rust
elixir
git
hg
cmd_exec_time
)
To exclude a segment from the prompt, you have several options:
BULLETTRAIN_PROMPT_ORDER
anywhere in your zshrc, as described here.BULLETTRAIN_PROMPT_ORDER[$BULLETTRAIN_PROMPT_ORDER[(i)nvm]]=()
somewhere in your zshrc after you've sourced bullet-train. When using oh-my-zsh, this means after the source "$ZSH/oh-my-zsh.sh"
line. What this does is that it removes the nvm
entry from the list of prompt segments to use.With that out of the way, I'm very interested as to why it's throwing errors for you. For testing reasons, I have removed both nvm and my nvm-managed Node versions from my PATH
and still didn't get any errors. That is consistent with my expectations, as the code includes proper error suppression and checks for existence around anything that tries to access either Node or nvm.
Thank you for clarifying.
Your suggestions are good I'm very likely to use one of them.
I made my implementation to keep in line with the pattern I saw used in bullet-train to provide options to enable/disable various elements of the prompt. But doing this for every segment would be a lot of work, and I'm not sure that it's worth the effort.
Your proposals should be in the main readme though.
I see that the current implementation has checks in place to suppress errors. This was not always the case.
I don't use NVM and an option to disable it's prompt is very useful for me, so I don't have to alter the theme file.