1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-15 12:19:49 +00:00

change: _ZL_EXCLUDE_DIRS to a comma separated list of dirs to exclude

This commit is contained in:
skywind3000
2019-02-12 19:22:18 +08:00
parent 7f5e8383db
commit b2a83f4c61
3 changed files with 6 additions and 6 deletions

View File

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

View File

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

8
z.lua
View File

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