1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-24 16:49:47 +00:00

6 Commits

Author SHA1 Message Date
skywind3000
a245db0d93 update doc 2019-08-01 19:54:34 +08:00
skywind3000
dd721703c3 1.7.2: improve bash / zsh shell compatibility 2019-08-01 19:46:23 +08:00
Linwei
7920d56c89 Merge pull request #71 from barlik/prompt-command
Do not append semicolon to PROMPT_COMMAND
2019-08-01 17:45:54 +08:00
Linwei
645818ccc8 Merge pull request #72 from barlik/zsh-hooks 2019-08-01 02:41:19 +08:00
Rastislav Barlik
b98911a227 Setting zsh-hooks to be unique is not necessary 2019-07-31 14:46:28 +01:00
Rastislav Barlik
671830059b Do not append semicolon to PROMPT_COMMAND 2019-07-31 13:47:55 +01:00
2 changed files with 7 additions and 6 deletions

View File

@@ -458,6 +458,7 @@ As you see, z.lua is the fastest one and requires less resource.
## History ## History
- 1.7.2 (2019-08-01): Improve bash/zsh shell compatibility by [@barlik](https://github.com/barlik).
- 1.7.1 (2019-06-07): Fixed: `$_ZL_DATA` failure on Linux sometimes. - 1.7.1 (2019-06-07): Fixed: `$_ZL_DATA` failure on Linux sometimes.
- 1.7.0 (2019-03-09): Support [ranger](https://github.com/skywind3000/z.lua/wiki/FAQ#how-to-integrate-zlua-to-ranger-), fix ReplaceFile issue in luajit (windows). - 1.7.0 (2019-03-09): Support [ranger](https://github.com/skywind3000/z.lua/wiki/FAQ#how-to-integrate-zlua-to-ranger-), fix ReplaceFile issue in luajit (windows).
- 1.6.0 (2019-03-04): optimize with ffi module (luajit builtin module). - 1.6.0 (2019-03-04): optimize with ffi module (luajit builtin module).

12
z.lua
View File

@@ -4,7 +4,7 @@
-- z.lua - a cd command that learns, by skywind 2018, 2019 -- z.lua - a cd command that learns, by skywind 2018, 2019
-- Licensed under MIT license. -- Licensed under MIT license.
-- --
-- Version 1.7.1, Last Modified: 2019/06/07 22:07 -- Version 1.7.2, Last Modified: 2019/08/01 19:45
-- --
-- * 10x faster than fasd and autojump, 3x faster than z.sh -- * 10x faster than fasd and autojump, 3x faster than z.sh
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox -- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -2010,14 +2010,14 @@ alias ${_ZL_CMD:-z}='_zlua'
local script_init_bash = [[ local script_init_bash = [[
case "$PROMPT_COMMAND" in case "$PROMPT_COMMAND" in
*_zlua?--add*) ;; *_zlua?--add*) ;;
*) PROMPT_COMMAND="(_zlua --add \"\$(command pwd 2>/dev/null)\" &);$PROMPT_COMMAND" ;; *) PROMPT_COMMAND="(_zlua --add \"\$(command pwd 2>/dev/null)\" &)${PROMPT_COMMAND:+;$PROMPT_COMMAND}" ;;
esac esac
]] ]]
local script_init_bash_fast = [[ local script_init_bash_fast = [[
case "$PROMPT_COMMAND" in case "$PROMPT_COMMAND" in
*_zlua?--add*) ;; *_zlua?--add*) ;;
*) PROMPT_COMMAND="(_zlua --add \"\$PWD\" &);$PROMPT_COMMAND" ;; *) PROMPT_COMMAND="(_zlua --add \"\$PWD\" &)${PROMPT_COMMAND:+;$PROMPT_COMMAND}" ;;
esac esac
]] ]]
@@ -2029,7 +2029,7 @@ _zlua_precmd() {
} }
case "$PROMPT_COMMAND" in case "$PROMPT_COMMAND" in
*_zlua_precmd*) ;; *_zlua_precmd*) ;;
*) PROMPT_COMMAND="_zlua_precmd;$PROMPT_COMMAND" ;; *) PROMPT_COMMAND="_zlua_precmd${PROMPT_COMMAND:+;$PROMPT_COMMAND}" ;;
esac esac
]] ]]
@@ -2056,7 +2056,7 @@ local script_init_zsh = [[
_zlua_precmd() { _zlua_precmd() {
(_zlua --add "${PWD:a}" &) (_zlua --add "${PWD:a}" &)
} }
typeset -gaU precmd_functions typeset -ga precmd_functions
[ -n "${precmd_functions[(r)_zlua_precmd]}" ] || { [ -n "${precmd_functions[(r)_zlua_precmd]}" ] || {
precmd_functions[$(($#precmd_functions+1))]=_zlua_precmd precmd_functions[$(($#precmd_functions+1))]=_zlua_precmd
} }
@@ -2066,7 +2066,7 @@ local script_init_zsh_once = [[
_zlua_precmd() { _zlua_precmd() {
(_zlua --add "${PWD:a}" &) (_zlua --add "${PWD:a}" &)
} }
typeset -gaU chpwd_functions typeset -ga chpwd_functions
[ -n "${chpwd_functions[(r)_zlua_precmd]}" ] || { [ -n "${chpwd_functions[(r)_zlua_precmd]}" ] || {
chpwd_functions[$(($#chpwd_functions+1))]=_zlua_precmd chpwd_functions[$(($#chpwd_functions+1))]=_zlua_precmd
} }