diff --git a/fish/config.fish b/fish/config.fish index 386f1df..964ac89 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,5 +1,13 @@ -# pyenv config -set -gx PYENV_ROOT $HOME/.pyenv -set -gx PATH $PYENV_ROOT/bin $PATH -status --is-interactive; and pyenv init - | source -status --is-interactive; and pyenv virtualenv-init - | source +# deno config +set -Ux DENO_INSTALL /home/t31m/.deno +set -Ux PATH $DENO_INSTALL/bin $PATH + +# pipx +if test (command -v pipx) + register-python-argcomplete --shell fish pipx | . +end + +# pyenv init +if command -v pyenv 1>/dev/null 2>&1 + pyenv init - | source +end \ No newline at end of file diff --git a/fish/theme-t31m/t31m_prompt.fish b/fish/theme-t31m/t31m_prompt.fish index 8834628..c815450 100644 --- a/fish/theme-t31m/t31m_prompt.fish +++ b/fish/theme-t31m/t31m_prompt.fish @@ -11,13 +11,24 @@ function prompt::awsenv end function prompt::pyenv - if test -n "$PYENV_VERSION" - echo -n -s (yellow)(printf '%s' \U1F40D)"["(cyan)"$PYENV_VERSION"(off)"@"(python -c "import sys;t='{v[0]}.{v[1]}.{v[2]}'.format(v=list(sys.version_info[:3]));sys.stdout.write(t)")(yellow)"]"(off) + + if test (command -v python) + set python_version (python -c "import sys;t='{v[0]}.{v[1]}.{v[2]}'.format(v=list(sys.version_info[:3]));sys.stdout.write(t)") + else + set python_version "" + end + + #if test -n "$python_version" + # echo -n -s (yellow)(printf '%s' \U1F40D)"["(off)"$python_version"(yellow)"]"(off) # else if test (command -v pyenv) - else if test -n "$VIRTUAL_ENV" - echo -n -s (yellow)(printf '%s' \U1F40D)"["(cyan)(pyenv version-name | sed 's/:.*$//' )(off)"@"(python -c "import sys;t='{v[0]}.{v[1]}.{v[2]}'.format(v=list(sys.version_info[:3]));sys.stdout.write(t)")(yellow)"]"(off) - else if test (command -v python) - echo -n -s (yellow)(printf '%s' \U1F40D)"["(cyan)(python -c "import sys;t='{v[0]}.{v[1]}.{v[2]}'.format(v=list(sys.version_info[:3]));sys.stdout.write(t)")(yellow)"]"(off) + if set -q VIRTUAL_ENV + set venv $VIRTUALENV | grep -Eo '[^/]+/?$' | cut -d / -f1 + echo -n -s (yellow)(printf '%s' \U1F40D)"[($venv"(cyan)(pyenv version-name | sed 's/:.*$//')(yellow)")"(off)"@$python_version"(yellow)"]"(off) + else if test -n "$PYENV_VERSION"; and [ "$PYENV_VERSION" != "$python_version" ] + # echo -n -s (yellow)(printf '%s' \U1F40D)"["(cyan)(pyenv version-name | sed 's/:.*$//' )(off)"@$python_version"(yellow)"]"(off) + echo -n -s (yellow)(printf '%s' \U1F40D)"["(cyan)(pyenv version-name )(off)"@$python_version"(yellow)"]"(off) + else if test -n "$python_version" + echo -n -s (yellow)(printf '%s' \U1F40D)"["(off)$python_version(yellow)"]"(off) end end diff --git a/fish_setup.sh b/fish_setup.sh index 74ce05b..aedea08 100755 --- a/fish_setup.sh +++ b/fish_setup.sh @@ -32,6 +32,8 @@ if test -f "~/.config/fish/fishfile"; then fi cp fish/fishfile ~/.config/fish/ +echo "set --export PYENV_ROOT $HOME/.pyenv" > ~/.config/fish/conf.d/pyenv.fish + # install packages from fishfile fish -c "fisher self-update" fish -c fisher