Refactor the env substution logic

And some prompt cleanup
This commit is contained in:
Abhishek Aryan 2021-05-02 21:53:22 +03:00 committed by GitHub
parent 8d6ce3e4ac
commit e8df3ef247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

13
vendor/clink.lua vendored
View File

@ -83,14 +83,13 @@ local function set_prompt_filter()
cr = ' ' cr = ' '
end end
if env ~= nil then if env ~= nil then env = "("..env..") " else env = "" end
prompt_lambSymbol = "("..env..") "..prompt_lambSymbol
end
prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{lamb} \x1b[0m" prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{env}{lamb} \x1b[0m"
uah_value = string.gsub(prompt, "{uah}", uah) prompt = string.gsub(prompt, "{uah}", uah)
new_value = string.gsub(uah_value, "{cwd}", cwd) prompt = string.gsub(prompt, "{cwd}", cwd)
clink.prompt.value = string.gsub(new_value, "{lamb}", prompt_lambSymbol) prompt = string.gsub(prompt, "{env}", env)
clink.prompt.value = string.gsub(prompt, "{lamb}", prompt_lambSymbol)
end end
local function percent_prompt_filter() local function percent_prompt_filter()