From 48a77adf3575952b2e951aa820a1ce11ed4ce56b Mon Sep 17 00:00:00 2001 From: fcying Date: Wed, 23 Dec 2020 14:38:40 +0800 Subject: [PATCH] add _ZL_CLINK_PROMPT_PRIORITY set clink prompt register priority. --- README.md | 1 + z.lua | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fb917cb..ba67e05 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ z -b foo # cd to the parent directory starting with foo - set `$_ZL_MATCH_MODE` to 1 to enable enhanced matching. - set `$_ZL_NO_CHECK` to 1 to disable path validation, use `z --purge` to clean - set `$_ZL_HYPHEN` to 1 to treat hyphon (-) as a normal character not a lua regexp keyword. +- set `$_ZL_CLINK_PROMPT_PRIORITY` change clink prompt register priority (default 99). ## Aging diff --git a/z.lua b/z.lua index dc3a75a..b7a6944 100755 --- a/z.lua +++ b/z.lua @@ -2059,6 +2059,7 @@ end ----------------------------------------------------------------------- function z_clink_init() local once = os.environ("_ZL_ADD_ONCE", false) + local _zl_clink_prompt_priority = os.environ('_ZL_CLINK_PROMPT_PRIORITY', 99) local previous = '' function z_add_to_database() pwd = clink.get_cwd() @@ -2070,7 +2071,7 @@ function z_clink_init() end z_add(clink.get_cwd()) end - clink.prompt.register_filter(z_add_to_database, 99) + clink.prompt.register_filter(z_add_to_database, _zl_clink_prompt_priority) function z_match_completion(word) local M = z_match({word}, Z_METHOD, Z_SUBDIR) for _, item in pairs(M) do