1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-17 05:09:49 +00:00

Merge pull request #145 from doubleloop/zluaexec

Try luajit in zsh and fish, fix ZLUA_EXEC check
This commit is contained in:
Linwei
2021-11-14 01:40:55 +08:00
committed by GitHub
3 changed files with 8 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ From people using z.lua:
- Integrated with FZF (optional) for interactive selection and completion.
- Quickly go back to a parent directory instead of typing "cd ../../..".
- Corresponding experience in different shells and operating systems.
- Compatible with Lua 5.1, 5.2 and 5.3+
- Compatible with Lua (5.1, 5.2, 5.3+) and luajit.
- Self contained, distributed as a single `z.lua` script, no other dependence.

View File

@@ -27,6 +27,8 @@ end
if test -e $_zlua_dir/z.lua
if type -q lua
lua $_zlua_dir/z.lua --init fish enhanced once echo | source
else if type -q luajit
luajit $_zlua_dir/z.lua --init fish enhanced once echo | source
else if type -q lua5.3
lua5.3 $_zlua_dir/z.lua --init fish enhanced once echo | source
else if type -q lua5.2

View File

@@ -2,11 +2,14 @@
ZLUA_SCRIPT="${0:A:h}/z.lua"
[[ -n "$ZLUA_EXEC" ]] && [[ ! -x "$ZLUA_EXEC" ]] && ZLUA_EXEC=""
if [[ -n "$ZLUA_EXEC" ]] && ! which "$ZLUA_EXEC" &>/dev/null; then
echo "$ZLUA_EXEC not found"
ZLUA_EXEC=""
fi
# search lua executable
if [[ -z "$ZLUA_EXEC" ]]; then
for lua in lua lua5.3 lua5.2 lua5.1; do
for lua in lua luajit lua5.3 lua5.2 lua5.1; do
ZLUA_EXEC="$(command -v "$lua")"
[[ -n "$ZLUA_EXEC" ]] && break
done