From 8600374371f91843064441113f4023cda1730877 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Sat, 18 Mar 2023 16:40:57 -0300 Subject: General fish fixes and updates --- .config/fish/functions/_tide_item_virtual_env.fish | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .config/fish/functions/_tide_item_virtual_env.fish (limited to '.config/fish/functions/_tide_item_virtual_env.fish') diff --git a/.config/fish/functions/_tide_item_virtual_env.fish b/.config/fish/functions/_tide_item_virtual_env.fish new file mode 100644 index 00000000..0f20ceec --- /dev/null +++ b/.config/fish/functions/_tide_item_virtual_env.fish @@ -0,0 +1,11 @@ +function _tide_item_virtual_env + test -n "$VIRTUAL_ENV" && split_virtual_env=(string split / "$VIRTUAL_ENV") if test $split_virtual_env[-2] = virtualenvs + # pipenv $VIRTUAL_ENV looks like /home/ilan/.local/share/virtualenvs/pipenv_project-EwRYuc3l + # Detect whether we are using pipenv by looking for virtualenvs. If so, remove the hash at the end. + _tide_print_item virtual_env $tide_virtual_env_icon' ' (string split -r -m1 - "$split_virtual_env[-1]")[1] + else if contains -- $split_virtual_env[-1] virtualenv venv .venv env # avoid generic names + _tide_print_item virtual_env $tide_virtual_env_icon' ' $split_virtual_env[-2] + else + _tide_print_item virtual_env $tide_virtual_env_icon' ' $split_virtual_env[-1] + end +end -- cgit v1.2.3