Closed daniel020403 closed 7 years ago
Do you want to see nvm/node segment?
If yes
- you need to install node
.
If no
- you need to remove it from BULLETTRAIN_PROMPT_ORDER
variable. (see https://github.com/caiogondim/bullet-train-oh-my-zsh-theme/wiki/Tips#bullettrain_prompt_order)
I just got this too & just removed it BULLETTRAIN_PROMPT_ORDER
.
IMHO it is quite annoying from a user's perspective that nvm
doesn't follow ruby
's behaviour of only showing when the version manager has changed it & not showing the system version all the time.
@zyphrus it divides users' requirements at some point which is (I think) harder to implement: some would only like the prompt to appear in project directories, and others would want to see them all the time, to see if they want an adhoc REPL then which version are they going to use.
Your concern about the features not working in a consistent way is real and thanks for bringing that up.
Why can't is check if npm is installed, and if not, disable it in the prompt?
I just spent an embarrassing amount of time figuring out how to only remove nvm
from BULLETTRAIN_PROMPT_ORDER
instead of explicitly setting it to a list of values. My rationale was that new elements—corresponding to new features of the theme—would be added to the default list in the future, and I might never know about them because I was overriding BULLETTRAIN_PROMPT_ORDER
explicitly. I'm not altogether certain this is a legitimate concern, but here's what I appended to my .zshrc
to remove the nvm
entry and leave the rest alone:
BULLETTRAIN_PROMPT_ORDER=($(echo ${BULLETTRAIN_PROMPT_ORDER[@]/nvm}))
I'm sure shell ninjas will spot several edge cases where this wouldn't work as expected, but I guess it's good enough for my current purposes. The biggest potential problem I see is that the pattern matching isn't restricted to word boundaries, so it could, conceivably, modify more than one entry. But I'm not too concerned about it because the breakage in this case is loud:
$ echo $BULLETTRAIN_PROMPT_ORDER
time status custom context dir perl ruby virtualenv go git hg cmd_exec_time
$ BULLETTRAIN_PROMPT_ORDER=($(echo ${BULLETTRAIN_PROMPT_ORDER[@]/g}))
build_prompt:4: command not found: prompt_o
build_prompt:4: command not found: prompt_it
build_prompt:4: command not found: prompt_h
$ echo $BULLETTRAIN_PROMPT_ORDER
time status custom context dir perl ruby virtualenv o it h cmd_exec_time
build_prompt:4: command not found: prompt_o
build_prompt:4: command not found: prompt_it
build_prompt:4: command not found: prompt_h
If anybody can tell me how to restrict the match to word boundaries, I'd be much obliged.
UPDATE
This seems to do the trick:
BULLETTRAIN_PROMPT_ORDER=($(echo ${BULLETTRAIN_PROMPT_ORDER[@]/#%nvm}))
It (still) operates on each element, but adding #%
to the beginning of the pattern means it will only match elements that are identically equal to nvm
, not items like nvm-pre
, nvm-post
or similar. (Discovered this ZSH feature by digging around on this page.)
Does installing node require a reboot before the error stops?
opening a new console should solve it. if not, try reloging in.
This is connected to #212 - closing in favor of it.
Hello,
I just changed my zsh theme today to
bullet train
and I noticed that it prompts the message below upon starting the terminal and after every command execution.Herewith attached is a screenshot of it.
Cheers!