diff --git a/plugins/path.sh b/plugins/path.sh index 94f8cab..8e3329d 100644 --- a/plugins/path.sh +++ b/plugins/path.sh @@ -9,8 +9,14 @@ function wish_path_end() { function wish_path_set_colors() { WISH_PATH_FG=${WISH_PATH_FG:-$WISH_DEFAULT_FG} WISH_PATH_BG=${WISH_PATH_BG:-$WISH_DEFAULT_BG} + WISH_PATH_NO_WRITE_SUFFIX=${WISH_PATH_NO_WRITE_SUFFIX:- } } function wish_path_main() { - wish_append $WISH_PATH_BG $WISH_PATH_FG " \w " + if [[ -w $PWD ]]; then + local path=" \w " + else + local path=" \w$WISH_PATH_NO_WRITE_SUFFIX " + fi + wish_append $WISH_PATH_BG $WISH_PATH_FG "$path" } diff --git a/plugins/python_venv.sh b/plugins/python_venv.sh new file mode 100644 index 0000000..c57e9bc --- /dev/null +++ b/plugins/python_venv.sh @@ -0,0 +1,21 @@ +function wish_python_venv_start() { + return 0 +} + +function wish_python_venv_end() { + return 0 +} + +function wish_python_venv_set_colors() { + WISH_PYTHON_VENV_FG=${WISH_PYTHON_VENV_FG:-$WISH_DEFAULT_FG} + WISH_PYTHON_VENV_BG=${WISH_PYTHON_VENV_BG:-$WISH_DEFAULT_BG} +} + +function wish_python_venv_main() { + if [[ -v VIRTUAL_ENV ]]; then + local venv=$(echo $VIRTUAL_ENV | sed 's|.*/||') + wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG " $venv " + else + wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG "" + fi +}