Last active
January 13, 2022 00:21
-
-
Save vivekragunathan/a48e9852da4c749e6074fa0fd1f7f0f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!elvish | |
| # Personalized based on the original prompt.elv shared by Kurtis Rader | |
| # https://gist.github.com/krader1961/615003e1527950b84a9eef9a45ebcb08 | |
| # NOTES:----------------------------------------------------------------- | |
| # Format of private variables: __variable-name__ Example: __host-name__ | |
| # | |
| # See also: | |
| # - https://github.com/zzamboni/elvish-themes/blob/master/chain.org#use | |
| # - https://github.com/krader1961/elvish-lib | |
| # - https://github.com/href/elvish-gitstatus/blob/master/gitstatus.elv | |
| # ----------------------------------------------------------------- | |
| # use github.com/krader1961/elvish-lib/cmd-duration | |
| use github.com/zzamboni/elvish-themes/chain | |
| # inlined from util module | |
| fn get-host-name {|| | |
| use platform | |
| platform:hostname &strip-domain | |
| } | |
| # Cache the machine name. It's cheap to retrieve but why pay the cost? | |
| var __host-name__ = (get-host-name) | |
| fn host-name-segment {|| | |
| chain:prompt-segment host-name $__host-name__ | |
| } | |
| fn get-prompt-segments {|| | |
| put [ su $host-name-segment~ dir arrow ] | |
| } | |
| fn main {|&use-git=$false| | |
| set chain:bold-prompt = $true | |
| set chain:prompt-segment-delimiters = [" " " "] # space on each side of a segment | |
| set chain:glyph[chain] = "" # No - connecting segments | |
| set chain:segment[arrow] = { | |
| put (styled "❱ " blink green) | |
| # put (styled "❱" blink red) | |
| # put (styled "❱" blink blue) | |
| } | |
| # set chain:segment[arrow] = { | |
| # # put (styled " >" bg-bright-cyan)" " | |
| # put (styled " > " default) | |
| # } | |
| set chain:segment-style[dir] = [bg-bright-green fg-black] | |
| set chain:segment-style[git-branch] = [bg-bright-magenta fg-black] | |
| set chain:segment-style[chain] = [default] | |
| set chain:segment-style[conda-env] = [bg-'#EEEEEE' fg-magenta] | |
| set chain:segment-style[host-name] = [bg-'#EEDDCC' fg-black] | |
| set chain:segment-style[cmd-duration] = [bg-bright-cyan fg-black] | |
| set chain:segment-style[shlvl] = [bg-bright-yellow fg-black] | |
| set chain:segment-style[arrow] = [bg-bright-cyan] | |
| # The right prompt reports how long the previous command | |
| # ran and whether we're in a nested shell. | |
| # fn shlvl-segment {|| | |
| # if (!= $E:SHLVL 1) { | |
| # chain:prompt-segment shlvl "SHLVL "$E:SHLVL | |
| # } | |
| # } | |
| # | |
| # fn cmd-duration-segment {|| | |
| # chain:prompt-segment cmd-duration (cmd-duration:human-readable $edit:command-duration) | |
| # } | |
| # | |
| # set chain:rprompt-segments = [ $shlvl-segment~ $cmd-duration-segment~ ] | |
| chain:init | |
| # set edit:rprompt-persistent = $true | |
| # set edit:prompt-stale-transform = {|x| styled $x "bg-bright-yellow" } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment