Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lebedov
Created May 2, 2019 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lebedov/78e3ff0dd48d893e74ada46753f28979 to your computer and use it in GitHub Desktop.
Save lebedov/78e3ff0dd48d893e74ada46753f28979 to your computer and use it in GitHub Desktop.
Bash tab completion of environment names when using conda activate
#!/bin/bash
# Add the following lines to .bashrc to enable tab completion of available conda
# environment names when using conda activate. Assumes conda and jq are in one's PATH:
export CONDA_ENV_LIST=`conda env list --json | jq -r '[ .envs[1:][] | split("/")[-1] ] | join(" ")'`
complete -W "$CONDA_ENV_LIST" conda activate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment