diff options
Diffstat (limited to '.config/shell')
-rw-r--r-- | .config/shell/env | 2 | ||||
-rw-r--r-- | .config/shell/functions.d/venv | 48 | ||||
-rw-r--r-- | .config/shell/sources | 7 | ||||
m--------- | .config/shell/vendor/bash/feature-auto-completion | 0 | ||||
m--------- | .config/shell/vendor/zsh/feature-syntax-highlighting | 0 |
5 files changed, 56 insertions, 1 deletions
diff --git a/.config/shell/env b/.config/shell/env index b69ce13..fe1e814 100644 --- a/.config/shell/env +++ b/.config/shell/env @@ -7,7 +7,7 @@ export LANG="en_US.UTF-8" export LESSCHARSET="utf-8" # Set favourite applications -export BROWSER="qutebrowser" +export BROWSER="firefox" export EDITOR="vim" export ALTERNATE_EDITOR="ed" diff --git a/.config/shell/functions.d/venv b/.config/shell/functions.d/venv new file mode 100644 index 0000000..c23a02d --- /dev/null +++ b/.config/shell/functions.d/venv @@ -0,0 +1,48 @@ +#!/bin/sh + +venv() { + if ! command -V "venv_$1" | grep -q " function " + then + cat <<EOF +Usage: + venv on + venv off + +Manage the python venv for a given project or directory. + +Commands: + on Enable the venv for \$PWD + off Deactivate the current venv +EOF + + return 1 + fi + + "venv_$1" +} + +venv_on() { + export PYTHON_VENV_DIR="$PWD/.venv" + export VIRTUAL_ENV_DISABLE_PROMPT=1 + + if [ ! -d "$PYTHON_VENV_DIR" ] + then + printf "Initializing venv directory at %s\n" "$PYTHON_VENV_DIR" + python3 -m venv "$PYTHON_VENV_DIR" + fi + + . "$PYTHON_VENV_DIR/bin/activate" +} + +venv_off() { + if [ -z "$PYTHON_VENV_DIR" ] + then + printf "No venv active?\n" + return 1 + fi + + deactivate + + unset PYTHON_VENV_DIR + unset VIRTUAL_ENV_DISABLE_PROMPT +} diff --git a/.config/shell/sources b/.config/shell/sources index 0709911..62a7f7b 100644 --- a/.config/shell/sources +++ b/.config/shell/sources @@ -27,6 +27,13 @@ then PATH="$PATH:/usr/local/share/perl6/vendor/bin" fi +# Python packages +if command -v python >/dev/null 2>&1 +then + PATH="$PATH:$(python -c 'import site; print(":".join(map(lambda x: x + "/usr/bin", site.getsitepackages())))')" + PATH="$PATH:$(python -c 'import site; print(":".join(map(lambda x: x + "/usr/sbin", site.getsitepackages())))')" +fi + # Load color definitions if they exist if [ -f "$HOME/.config/shell/colors/$SHORTSHELL" ] then diff --git a/.config/shell/vendor/bash/feature-auto-completion b/.config/shell/vendor/bash/feature-auto-completion new file mode 160000 +Subproject a18a07b34b37377bb523afa78899259f21d575a diff --git a/.config/shell/vendor/zsh/feature-syntax-highlighting b/.config/shell/vendor/zsh/feature-syntax-highlighting new file mode 160000 +Subproject e0165eaa730dd0fa321a6a6de74f092fe87630b |