Skip to content

Instantly share code, notes, and snippets.

@watain666
Last active July 2, 2020 08:15
Show Gist options
  • Save watain666/9492c3ca28b23f7a5061247075c7a6b5 to your computer and use it in GitHub Desktop.
Save watain666/9492c3ca28b23f7a5061247075c7a6b5 to your computer and use it in GitHub Desktop.
Add current date/time to clink/cmder prompt. Ref: https://superuser.com/a/1192357/916566
function custom_prompt()
cwd = clink.get_cwd()
prompt = "\x1b[1;32;40m{cwd} {git} {hg}\x1b[1;30;40m{time}\n{lamb} \x1b[0m"
new_value = string.gsub(prompt, "{cwd}", cwd)
add_time = string.gsub(new_value, "{time}", os.date("%x - %X"))
clink.prompt.value = string.gsub(add_time, "{lamb}", "λ")
end
clink.prompt.register_filter(custom_prompt, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment