1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-14 11:49:48 +00:00

update z.lua

This commit is contained in:
skywind3000
2018-11-21 19:43:04 +08:00
parent 5719135b9c
commit bf6d2fe237
2 changed files with 21 additions and 3 deletions

View File

@@ -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

22
z.lua
View File

@@ -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