Created
May 20, 2018 09:22
-
-
Save amstiel/910ed16b25d3e2a87bdf34ce402227cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Cmder console '~' resolving' | |
-- Press ~<Tab> for resolving home dir | |
local function tilde_match (text, f, l) | |
if text == '~' then | |
clink.add_match(clink.get_env('home')) | |
clink.matches_are_files() | |
return true | |
end | |
if text:sub(1, 1) == '~' then | |
clink.add_match(string.gsub(text, "~", clink.get_env('home'), 1)) | |
-- second match prevents adding a space so we can look for more matches | |
clink.add_match(string.gsub(text, "~", clink.get_env('home'), 1) .. '+') | |
clink.matches_are_files() | |
return true | |
end | |
end | |
clink.register_match_generator(tilde_match, 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment