-
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 export VIRTUAL_ENV_DISABLE_PROMPT=1 #Disable conda prompt changes #https://conda.io/docs/user-guide/configuration/use-condarc.html#change-command-prompt-changeps1 #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%}" fi } function conda_info { if [[ -n "$CONDA_DEFAULT_ENV" ]]; then echo "%{$fg[green]%}‹${CONDA_DEFAULT_ENV}›%{$reset_color%}" fi } 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 thisPROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} ${conda} ${venv} ╰─%B${user_symbol}%b "
-
Source
~/.zshrc
to see if changes have taken place
Last active
October 7, 2024 22:04
-
-
Save Samyak2/6676c608371e915e3c066dbbdcc25622 to your computer and use it in GitHub Desktop.
Adding virtualenv and conda support to Oh My Zsh Bira theme
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using the jonathan theme , and all the solution above didn't work in jonathan because Jonathan has a different code structure from Bira . To display conda info in jonathan , just add the function "conda_info" to
.oh-my-zsh/themes/jonathan.zsh-theme
:As Jonathan has 2 lines of output and the first output line was filled by a function using "------" . If conda info displays in the first line , those "------" will be out of your screen . So :
add '${$(conda_prompt_info)}' to the SECOND LINE OF OUTPUT in the PROMPT . the PROMPT was devided into 2 parts by a empty line , so you can easily find where to add conda info . For me , I added it after the time info . My PROMPT is like
I hope this will help someone too XD