1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-13 11:19:50 +00:00
Files
z.lua/z.lua.plugin.zsh
Jakub Łuczyński c88746629b zsh plugin: fix ZLUA_EXEC check
Previous check required full path (even if value was available in PATH)
2021-11-13 10:33:41 +01:00

36 lines
754 B
Bash

#! /usr/bin/env zsh
ZLUA_SCRIPT="${0:A:h}/z.lua"
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 luajit lua5.3 lua5.2 lua5.1; do
ZLUA_EXEC="$(command -v "$lua")"
[[ -n "$ZLUA_EXEC" ]] && break
done
if [[ -z "$ZLUA_EXEC" ]]; then
echo "Not find lua in your $PATH, please install it."
return
fi
fi
export _ZL_FZF_FLAG=${_ZL_FZF_FLAG:-"-e"}
eval "$($ZLUA_EXEC $ZLUA_SCRIPT --init zsh once enhanced)"
if [[ -z "$_ZL_NO_ALIASES" ]]; then
alias zz='z -i'
alias zc='z -c'
alias zf='z -I'
alias zb='z -b'
alias zbi='z -b -i'
alias zbf='z -b -I'
alias zh='z -I -t .'
alias zzc='zz -c'
fi