Last active
August 5, 2024 15:31
-
-
Save mikehazell/e2d4d77575ace164e636ec2347a24697 to your computer and use it in GitHub Desktop.
oh-my-zsh Default Theme plus Node version info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# oh-my-zsh Theme | |
# Default robbyrussell theme with node version info. | |
# Installation: place this file in .oh-my-zsh/custom/themes/robbyrussell.zsh_theme | |
function node_prompt_version { | |
if which node &> /dev/null; then | |
echo "%{$fg_bold[blue]%}node(%{$fg[red]%}$(node -v)%{$fg[blue]%}) %{$reset_color%}" | |
fi | |
} | |
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" | |
PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(node_prompt_version)$(git_prompt_info)' | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
Be sure to rename the file with a dash if you're finding this and wondering why it's not working .oh-my-zsh/custom/themes/robbyrussell.zsh-theme
.
thanks, it works!
thanks, help me a lot. echo
transfer to echo -n
I defined a local variable for
node_prompt_version
result (local node_version='$(node_prompt_version)'
), now I can switch node using nvm with correct node version on prompt.
thanks, nice idea!
Cool thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I defined a local variable for
node_prompt_version
result (local node_version='$(node_prompt_version)'
), now I can switch node using nvm with correct node version on prompt.