zshoh-my-zshzshrc

RVM showing Ruby version in ZSH


I just installed rvm to upgrade ruby using the method outlined here. After installation my zsh instance now always displays rvm:ruby-2.3.0, as per this image:

enter image description here

I'd rather it not appear but I'm having trouble finding where it's set, any thoughts? It's pretty annoying.

Thanks!


Solution

  • Your prompt is set in a .zsh-theme file that is specified in your .zshrc file in your home directory.

    Changing to another theme:

    If you want to change your prompt to a preexisting one, open your .zshrc file with your favorite text editor. Your can find your .zshrc in ~/.zshrc. When you open that file you will see a line that looks something like this: ZSH_THEME="gallois". (It looks like you're using gallois)

    This is the line that you should change if you want to change your entire prompt. For example, change your this from ZSH_THEME="gallois" to ZSH_THEME="dallas" to change to the preexisting dallas theme. Click here For a list of all the default themes and what they look like. These themes are located in ~/.oh-my-zsh/themes.

    You should then run . ~/.zshrc to source zsh and you will see the new prompt.

    Editing the gallois theme to remove the right prompt

    These themes are located in ~/.oh-my-zsh/themes. I would recommend copying the gallois.zsh-theme file and making some other file like yourname.zsh-theme. In the theme file you can remove the right prompt entirely by removing the line below this comment:

    # Combine it all into a final right-side prompt
    RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1'
    

    You should probably remove this from the theme file as well for good measure:

    # RVM component of prompt
    ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}["
    ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}"
    
    #Customized git status, oh-my-zsh currently does not allow render dirty status before branch
    git_custom_status() {
      local cb=$(git_current_branch)
      if [ -n "$cb" ]; then
        echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
      fi
    }
    

    Keep in mind, this will also remove any descriptions about git repos from your prompt. You should then run . ~/.zshrc to source zsh and you will see the new prompt.

    Editing the gallois theme to only remove the ruby prompt

    These themes are located in ~/.oh-my-zsh/themes. I would recommend copying the gallois.zsh-theme file and making some other file like yourname.zsh-theme. In the theme file you can remove just the rvm prompt by removing a portion of this line:

    # Combine it all into a final right-side prompt
    RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1'
    

    If you just remove the $(ruby_prompt_info) portion so that it looks like this:

    # Combine it all into a final right-side prompt
    RPS1='$(git_custom_status) $EPS1'
    

    Then you can skip to the end and only remove the rvm portion of the prompt. I would also recommend removing these lines to avoid cluttering the theme file:

    # RVM component of prompt
    ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}["
    ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}"
    

    You should then run . ~/.zshrc to source zsh and you will see the new prompt.