From e8df3ef24717098b5c4f1bb1af09db33ac1326ee Mon Sep 17 00:00:00 2001 From: Abhishek Aryan <22198661+Lunchb0ne@users.noreply.github.com> Date: Sun, 2 May 2021 21:53:22 +0300 Subject: [PATCH] Refactor the env substution logic And some prompt cleanup --- vendor/clink.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index c01d6be..ab28858 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -83,14 +83,13 @@ local function set_prompt_filter() cr = ' ' end - if env ~= nil then - prompt_lambSymbol = "("..env..") "..prompt_lambSymbol - end + if env ~= nil then env = "("..env..") " else env = "" end - prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{lamb} \x1b[0m" - uah_value = string.gsub(prompt, "{uah}", uah) - new_value = string.gsub(uah_value, "{cwd}", cwd) - clink.prompt.value = string.gsub(new_value, "{lamb}", prompt_lambSymbol) + prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{env}{lamb} \x1b[0m" + prompt = string.gsub(prompt, "{uah}", uah) + prompt = string.gsub(prompt, "{cwd}", cwd) + prompt = string.gsub(prompt, "{env}", env) + clink.prompt.value = string.gsub(prompt, "{lamb}", prompt_lambSymbol) end local function percent_prompt_filter()