Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Adding virtualenv and conda support to Oh My Zsh Bira theme

Steps to add virtualenv and conda support to Bira theme

  • Add the virtualenv plugin to ~/.zshrc and make sure these lines are in ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh

    # disables prompt mangling in virtual_env/bin/activate
    #Disable conda prompt changes
    #changeps1: False
    `conda config --set changeps1 false`
  • Add these two helper functions to ~/.oh-my-zsh/themes/bira.zsh-theme (add them near the top, not at the end)

    function venv_info {
        if [[ -n "$VIRTUAL_ENV" ]]; then
            echo "%{$fg[green]%}‹${VIRTUAL_ENV:t}›%{$reset_color%}"
    function conda_info {
        if [[ -n "$CONDA_DEFAULT_ENV" ]]; then
            echo "%{$fg[green]%}‹${CONDA_DEFAULT_ENV}›%{$reset_color%}"
    local venv='$(venv_info)'
    local conda='$(conda_info)'
  • Add it to the prompt

    Look for the PROMPT variable in the same file and add ${conda} ${venv} to it (The order in which they should appear is your preference). It should look like this

    PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} ${conda} ${venv}
    ╰─%B${user_symbol}%b "
  • Source ~/.zshrc to see if changes have taken place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment