mirror of
https://github.com/conda-incubator/conda-zsh-completion.git
synced 2026-08-20 00:48:25 +08:00
Set initial value outside of local.
This commit is contained in:
12
_conda
12
_conda
@@ -53,14 +53,14 @@
|
|||||||
# to your '.zshrc':
|
# to your '.zshrc':
|
||||||
#
|
#
|
||||||
# zstyle ":conda_zsh_completion:*" sort-envs-by-time true
|
# zstyle ":conda_zsh_completion:*" sort-envs-by-time true
|
||||||
#
|
#
|
||||||
# The completion will display both global environments (envs located in conda_dir/envs and base env)
|
# The completion will display both global environments (envs located in conda_dir/envs and base env)
|
||||||
# and local environments (located in ~/.conda/envs).
|
# and local environments (located in ~/.conda/envs).
|
||||||
# If enables sort-envs-by-time, it will display local environments first.
|
# If enables sort-envs-by-time, it will display local environments first.
|
||||||
# To display global environments first, add the following to your '.zshrc':
|
# To display global environments first, add the following to your '.zshrc':
|
||||||
#
|
#
|
||||||
# zstyle ":conda_zsh_completion:*" show-global-envs-first true
|
# zstyle ":conda_zsh_completion:*" show-global-envs-first true
|
||||||
#
|
#
|
||||||
# If not enables sort-envs-by-time, then all environments will be sorted by alphabetical order,
|
# If not enables sort-envs-by-time, then all environments will be sorted by alphabetical order,
|
||||||
# and this option is useless.
|
# and this option is useless.
|
||||||
#
|
#
|
||||||
@@ -154,13 +154,15 @@ local -A opt_args
|
|||||||
|
|
||||||
__conda_envs(){
|
__conda_envs(){
|
||||||
local -a envs unnamed sort globalfirst localenvs globalenvs
|
local -a envs unnamed sort globalfirst localenvs globalenvs
|
||||||
local -a ls_opts=("-1")
|
local -a ls_opts
|
||||||
local -a describe_opts
|
local -a describe_opts
|
||||||
local localenvspath
|
local localenvspath
|
||||||
# only parse environments.txt (including unnamed envs) if asked by the user
|
# only parse environments.txt (including unnamed envs) if asked by the user
|
||||||
zstyle -s ":conda_zsh_completion:*" show-unnamed unnamed
|
zstyle -s ":conda_zsh_completion:*" show-unnamed unnamed
|
||||||
zstyle -s ":conda_zsh_completion:*" sort-envs-by-time sort
|
zstyle -s ":conda_zsh_completion:*" sort-envs-by-time sort
|
||||||
zstyle -s ":conda_zsh_completion:*" show-global-envs-first globalfirst
|
zstyle -s ":conda_zsh_completion:*" show-global-envs-first globalfirst
|
||||||
|
|
||||||
|
ls_opts=("-1")
|
||||||
if test -n "$sort"; then
|
if test -n "$sort"; then
|
||||||
ls_opts+=("-t")
|
ls_opts+=("-t")
|
||||||
describe_opts+=("-V")
|
describe_opts+=("-V")
|
||||||
@@ -185,8 +187,8 @@ __conda_envs(){
|
|||||||
else
|
else
|
||||||
envs=($localenvs $globalenvs)
|
envs=($localenvs $globalenvs)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# unmaned envs (if show-unammed).
|
# unmaned envs (if show-unammed).
|
||||||
if test -n "$unnamed"; then
|
if test -n "$unnamed"; then
|
||||||
envs+=($( (test -n "$unnamed" && cat ${HOME:?}/.conda/environments.txt) | cut -f1 -d' ' | sed -e "s|^$localenvspath/||"))
|
envs+=($( (test -n "$unnamed" && cat ${HOME:?}/.conda/environments.txt) | cut -f1 -d' ' | sed -e "s|^$localenvspath/||"))
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user