diff --git a/README.md b/README.md index 9065994..4f8d6d5 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ An alternative to [z.sh](https://github.com/rupa/z) with windows and posix shell - **10x** times faster than **fasd** and **autojump** - **3x** times faster than **z.sh** -- supports **posix shells**: bash, zsh, dash, sh, busybox, and etc. +- compatible with **posix shells**: bash, zsh, dash, sh, ash, busybox and etc. - supports Windows cmd (with clink) and cmder - self contained, no dependence on awk/gawk diff --git a/z.lua b/z.lua index ec7bac6..449ebc0 100644 --- a/z.lua +++ b/z.lua @@ -8,7 +8,8 @@ -- -- * 10x times faster than fasd and autojump -- * 3x times faster than rupa/z --- * supports: Bash, Zsh, Posix shells and Windows cmd +-- * compatible with posix shells: bash, zsh, sh, ash, dash, busybox +-- * supports windows -- -- USE: -- * z foo # cd to most frecent dir matching foo @@ -1223,11 +1224,28 @@ function z_shell_init(opts) print(script_init_zsh) end print(script_complete_zsh) - else + elseif opts.posix ~= nil then if prompt_hook then print(script_init_posix) end print('_ZL_NOBUILTIN=1') + else + print('if [ -n "$BASH_VERSION" ]; then') + if prompt_hook then + print(script_init_bash) + end + print(script_complete_bash) + print('elif [ -n "$ZSH_VERSION" ]; then') + if prompt_hook then + print(script_init_zsh) + end + -- print(script_complete_zsh) + print('else') + if prompt_hook then + print(script_init_posix) + end + print('_ZL_NOBUILTIN=1') + print('fi') end end