Skip to content

Commit 35e1199

Browse files
authored
Merge pull request #145 from doubleloop/zluaexec
Try luajit in zsh and fish, fix ZLUA_EXEC check
2 parents a3d4f5d + 99dbe7b commit 35e1199

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ From people using z.lua:
3535
- Integrated with FZF (optional) for interactive selection and completion.
3636
- Quickly go back to a parent directory instead of typing "cd ../../..".
3737
- Corresponding experience in different shells and operating systems.
38-
- Compatible with Lua 5.1, 5.2 and 5.3+
38+
- Compatible with Lua (5.1, 5.2, 5.3+) and luajit.
3939
- Self contained, distributed as a single `z.lua` script, no other dependence.
4040

4141

init.fish

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ end
2727
if test -e $_zlua_dir/z.lua
2828
if type -q lua
2929
lua $_zlua_dir/z.lua --init fish enhanced once echo | source
30+
else if type -q luajit
31+
luajit $_zlua_dir/z.lua --init fish enhanced once echo | source
3032
else if type -q lua5.3
3133
lua5.3 $_zlua_dir/z.lua --init fish enhanced once echo | source
3234
else if type -q lua5.2

z.lua.plugin.zsh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
ZLUA_SCRIPT="${0:A:h}/z.lua"
44

5-
[[ -n "$ZLUA_EXEC" ]] && [[ ! -x "$ZLUA_EXEC" ]] && ZLUA_EXEC=""
5+
if [[ -n "$ZLUA_EXEC" ]] && ! which "$ZLUA_EXEC" &>/dev/null; then
6+
echo "$ZLUA_EXEC not found"
7+
ZLUA_EXEC=""
8+
fi
69

710
# search lua executable
811
if [[ -z "$ZLUA_EXEC" ]]; then
9-
for lua in lua lua5.3 lua5.2 lua5.1; do
12+
for lua in lua luajit lua5.3 lua5.2 lua5.1; do
1013
ZLUA_EXEC="$(command -v "$lua")"
1114
[[ -n "$ZLUA_EXEC" ]] && break
1215
done

0 commit comments

Comments
 (0)