From 1ec5448fb683f06933bcc90e3844a23d3bcc0625 Mon Sep 17 00:00:00 2001 From: Ilan Cosman Date: Fri, 22 Dec 2023 16:00:30 -0800 Subject: [PATCH] fix python vs python3 in python item (fixes #459) --- functions/_tide_item_python.fish | 13 ++++++++++--- functions/fish_prompt.fish | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/functions/_tide_item_python.fish b/functions/_tide_item_python.fish index 2d9e52b3..57f7075a 100644 --- a/functions/_tide_item_python.fish +++ b/functions/_tide_item_python.fish @@ -1,7 +1,10 @@ function _tide_item_python if test -n "$VIRTUAL_ENV" - python --version | string match -qr "(?[\d.]+)" - + if command -q python3 + python3 --version | string match -qr "(?[\d.]+)" + else + python --version | string match -qr "(?[\d.]+)" + end string match -qr "^.*/(?.*)/(?.*)" $VIRTUAL_ENV # 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. @@ -14,7 +17,11 @@ function _tide_item_python _tide_print_item python $tide_python_icon' ' "$v ($base)" end else if path is .python-version Pipfile __init__.py pyproject.toml requirements.txt setup.py - python --version | string match -qr "(?[\d.]+)" + if command -q python3 + python3 --version | string match -qr "(?[\d.]+)" + else + python --version | string match -qr "(?[\d.]+)" + end _tide_print_item python $tide_python_icon' ' $v end end diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 563d9268..f4bfe243 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -151,6 +151,23 @@ end" if test "$tide_prompt_transient_enabled" = true function _tide_enter_transient + set -l line (commandline --line) + + commandline --search-mode + set -l search_mode_status $status + + commandline --paging-mode + set -l paging_mode_status $status + + commandline --paging-full-mode + set -l paging_full_mode_status $status + + commandline --is-valid + set -l is_valid_status $status + + echo "line: $line, search: $search_mode_status, paging: $paging_mode_status, paging_full: $paging_full_mode_status, is_valid: $is_valid_status" >>~/commandline_status + + # If the commandline will be executed, or is empty if commandline --is-valid || test -z "$(commandline)" set -g _tide_transient