Skip to content

Instantly share code, notes, and snippets.

@juancarlospaco
Last active April 7, 2021 16:10
Show Gist options
  • Save juancarlospaco/a641fb8a71e81c11ab567672ecc307ff to your computer and use it in GitHub Desktop.
Save juancarlospaco/a641fb8a71e81c11ab567672ecc307ff to your computer and use it in GitHub Desktop.
ZSH Terminal "DIY prompt", uses https://github.com/icyphox/nicy
import strformat, times, os, osproc, nicypkg/functions
export functions
when isMainModule:
let
prompt = returnCondition(ok = "👍", ng = "👎") & " "
nl = "\n"
gitBranch = color(gitBranch(), "yellow")
cwd = color(tilde(getCwd()), "cyan")
dirty = color("×", "red")
clean = color("•", "green")
git = gitBranch & gitStatus(dirty, clean)
ni = execCmdEx("nim --version").output[21 .. 25]
py = execCmdEx("python --version").output[7 .. ^4]
echo fmt"{user()}@x {virtualenv()}{cwd} {getClockStr()[0..^4]} Py{py} Nim{ni} {git}{nl}{prompt}"
@juancarlospaco
Copy link
Author

juancarlospaco commented Oct 30, 2019

nim-nicy

$ nim c -d:release -d:danger --out:~/.nimble/bin/nicy nicy.nim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment