From b2a83f4c6159c006b38da82605f47c665eeba9a9 Mon Sep 17 00:00:00 2001 From: skywind3000 Date: Tue, 12 Feb 2019 19:22:18 +0800 Subject: [PATCH] change: _ZL_EXCLUDE_DIRS to a comma separated list of dirs to exclude --- README.cn.md | 2 +- README.md | 2 +- z.lua | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.cn.md b/README.cn.md index 521419d..3f6ec51 100644 --- a/README.cn.md +++ b/README.cn.md @@ -105,7 +105,7 @@ z -b foo # 跳转到父目录中名称以 foo 开头的那一级 - 设置 `$_ZL_CMD` 来改变命令名称 (默认为 z)。 - 设置 `$_ZL_DATA` 来改变数据文件 (default ~/.zlua)。 - 设置 `$_ZL_NO_PROMPT_COMMAND` 为 1 来跳过钩子函数初始化(方便自己处理)。 -- 设置 `$_ZL_EXCLUDE` 来确定一个你不想收集的路径数组。 +- 设置 `$_ZL_EXCLUDE_DIRS` 逗号分隔的路径列表,列表内的路径不会被收集。 - 设置 `$_ZL_ADD_ONCE` 为 '1' 时,仅在当前路径 `$PWD` 改变时才更新数据库。 - 设置 `$_ZL_MAXAGE` 来确定一个数据老化的阀值 (默认为 5000)。 - 设置 `$_ZL_CD` 用来指定你想用的 cd 命令,比如有人用 cd_func 。 diff --git a/README.md b/README.md index 7cb5e38..b8c3100 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ z -b foo # cd to the parent directory starting with foo - set `$_ZL_CMD` in .bashrc/.zshrc to change the command (default z). - set `$_ZL_DATA` in .bashrc/.zshrc to change the datafile (default ~/.zlua). - set `$_ZL_NO_PROMPT_COMMAND` if you're handling PROMPT_COMMAND yourself. -- set `$_ZL_EXCLUDE` to an array of directories to exclude. +- set `$_ZL_EXCLUDE_DIRS` to a comma separated list of dirs to exclude. - set `$_ZL_ADD_ONCE` to '1' to update database only if `$PWD` changed. - set `$_ZL_MAXAGE` to define a aging threshold (default is 5000). - set `$_ZL_CD` to specify your own cd command. diff --git a/z.lua b/z.lua index 311ef0d..ab375c6 100755 --- a/z.lua +++ b/z.lua @@ -4,7 +4,7 @@ -- z.lua - a cd command that learns, by skywind 2018, 2019 -- Licensed under MIT license. -- --- Version 1.4.5, Last Modified: 2019/02/10 21:53 +-- Version 1.4.6, Last Modified: 2019/02/12 19:19 -- -- * 10x faster than fasd and autojump, 3x faster than z.sh -- * available for posix shells: bash, zsh, sh, ash, dash, busybox @@ -67,7 +67,7 @@ -- set $_ZL_CMD in .bashrc/.zshrc to change the command (default z). -- set $_ZL_DATA in .bashrc/.zshrc to change the datafile (default ~/.zlua). -- set $_ZL_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself. --- set $_ZL_EXCLUDE to an array of directories to exclude. +-- set $_ZL_EXCLUDE_DIRS to a comma separated list of dirs to exclude. -- set $_ZL_ADD_ONCE to 1 to update database only if $PWD changed. -- set $_ZL_CD to specify your own cd command -- set $_ZL_ECHO to 1 to display new directory name after cd. @@ -1649,7 +1649,7 @@ end function z_init() local _zl_data = os.getenv('_ZL_DATA') local _zl_maxage = os.getenv('_ZL_MAXAGE') - local _zl_exclude = os.getenv('_ZL_EXCLUDE') + local _zl_exclude = os.getenv('_ZL_EXCLUDE_DIRS') local _zl_cmd = os.getenv('_ZL_CMD') local _zl_matchname = os.getenv('_ZL_MATCH_NAME') local _zl_skippwd = os.getenv('_ZL_SKIP_PWD') @@ -1674,7 +1674,7 @@ function z_init() end end if _zl_exclude ~= nil and _zl_exclude ~= "" then - local part = _zl_exclude:split(windows and ';' or ':') + local part = _zl_exclude:split(',') local insensitive = path_case_insensitive() for _, name in ipairs(part) do if insensitive then