From f11f68c751ba63f82da06a221ef2e0550033c5aa Mon Sep 17 00:00:00 2001 From: tiyn Date: Fri, 8 May 2026 02:39:44 +0200 Subject: [PATCH] Zsh/Nvim: made python handling more readably --- .config/zsh/.zshrc | 4 ++-- .local/bin/etc/nvim/compiler | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 5866093..fbdc1af 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -113,7 +113,7 @@ uv() { fi } -find_uv_root() { +find_python_root() { local target="$1" local dir @@ -142,7 +142,7 @@ uvshim() { local uv_root="" local first_arg="$1" - uv_root="$(find_uv_root "$first_arg")" + uv_root="$(find_python_root "$first_arg")" if [[ -n "$uv_root" ]]; then uv run --project "$uv_root" "$cmd" "$@" diff --git a/.local/bin/etc/nvim/compiler b/.local/bin/etc/nvim/compiler index 2283cf0..ff24de3 100755 --- a/.local/bin/etc/nvim/compiler +++ b/.local/bin/etc/nvim/compiler @@ -14,7 +14,7 @@ vipercmd="carbon" #"silicon" cd "$dir" || exit -has_uv_project() { +has_python_version() { dir="$PWD" while [ "$dir" != "/" ]; do if [ -f "$dir/.python-version" ] || [ -f "$dir/pyproject.toml" ]; then @@ -45,7 +45,7 @@ case "$file" in *\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf >"$base".pdf ;; *\.ms) refer -PS -e "$file" | groff -me -ms -kept -T pdf >"$base".pdf ;; *\.py) - if has_uv_project; then + if has_python_version; then uv run python "$file" else python3 "$file"