From a8e92e021602aae136e72eb2bf1c3b520e01cdd7 Mon Sep 17 00:00:00 2001 From: skywind3000 Date: Sun, 27 Mar 2022 21:51:29 +0800 Subject: [PATCH] fix Monterey initialization issues --- z.lua | 9 ++++++--- z.lua.plugin.zsh | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/z.lua b/z.lua index 27ce796..1f067c0 100755 --- a/z.lua +++ b/z.lua @@ -4,7 +4,7 @@ -- z.lua - a cd command that learns, by skywind 2018-2022 -- Licensed under MIT license. -- --- Version 1.8.14, Last Modified: 2022/01/30 21:53 +-- Version 1.8.15, Last Modified: 2022/03/27 21:38 -- -- * 10x faster than fasd and autojump, 3x faster than z.sh -- * available for posix shells: bash, zsh, sh, ash, dash, busybox @@ -527,13 +527,16 @@ function os.path.abspath(path) return test end end - for _, python in pairs({'python', 'python2', 'python3'}) do + for _, python in pairs({'python3', 'python2', 'python'}) do local s = 'sys.stdout.write(os.path.abspath(sys.argv[1]))' local s = '-c "import os, sys;' .. s .. '" \'' .. path .. '\'' local s = python .. ' ' .. s local test = os.path.which(python) if test ~= nil and test ~= '' then - return os.call(s) + test = os.call(s) + if test ~= nil and test ~= '' then + return test + end end end end diff --git a/z.lua.plugin.zsh b/z.lua.plugin.zsh index 971fa72..8109dbe 100644 --- a/z.lua.plugin.zsh +++ b/z.lua.plugin.zsh @@ -9,7 +9,7 @@ fi # search lua executable if [[ -z "$ZLUA_EXEC" ]]; then - for lua in lua luajit lua5.3 lua5.2 lua5.1; do + for lua in lua luajit lua5.4 lua5.3 lua5.2 lua5.1; do ZLUA_EXEC="$(command -v "$lua")" [[ -n "$ZLUA_EXEC" ]] && break done