mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 17:59:11 +08:00
add ~ match to vendor/clink.lua/
This commit is contained in:
parent
45e5600249
commit
3a44bc809d
17
vendor/clink.lua
vendored
17
vendor/clink.lua
vendored
@ -385,7 +385,24 @@ local function svn_prompt_filter()
|
||||
return false
|
||||
end
|
||||
|
||||
local function tilde_match (text, f, l)
|
||||
if text == '~' then
|
||||
clink.add_match(clink.get_env('userprofile'))
|
||||
clink.matches_are_files()
|
||||
return true
|
||||
end
|
||||
|
||||
if text:sub(1, 1) == '~' then
|
||||
clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1))
|
||||
-- second match prevents adding a space so we can look for more matches
|
||||
clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1) .. '+')
|
||||
clink.matches_are_files()
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- insert the set_prompt at the very beginning so that it runs first
|
||||
clink.register_match_generator(tilde_match, 1)
|
||||
clink.prompt.register_filter(set_prompt_filter, 1)
|
||||
clink.prompt.register_filter(hg_prompt_filter, 50)
|
||||
clink.prompt.register_filter(git_prompt_filter, 50)
|
||||
|
Loading…
Reference in New Issue
Block a user