nix machine / user configurations
1let host_colors = { 2 higashi: {start: "0xEC5228", end: "0xEF9651"}, 3 wolumonde: {start: "0x603F26", end: "0x6C4E31"}, 4 chernobog: {start: "0xA94438", end: "0xD24545"}, 5 "sd-148036": {start: "0x595CFF", end: "0xC6F8FF"}, 6 dzwonek: {start: "0x595CFF", end: "0xC6F8FF"}, 7 volsinii: {start: "0x595CFF", end: "0xC6F8FF"}, 8} 9let user_colors = { 10 kirara: {start: "0xFF407D", end: "0xEE99C2"}, 11 root: {start: "0xC5172E", end: "0xBF3131"}, 12 dusk: {start: "0x640D5F", end: "0xD91656"}, 13} 14 15def create_left_prompt [] { 16 let hostname = sys host | get hostname 17 # str replace handles whoami output on windows 18 let username = ^whoami | str replace $"($hostname)\\" "" 19 20 let c = $host_colors | get $hostname 21 let hostname_fmt = $hostname | ansi gradient --fgstart $c.start --fgend $c.end 22 let c = $user_colors | get $username 23 let username_fmt = $username | ansi gradient --fgstart $c.start --fgend $c.end 24 25 let dir = match (do -i { $env.PWD | path relative-to $nu.home-path }) { 26 null => $env.PWD 27 '' => '~' 28 $relative_pwd => ([~ $relative_pwd] | path join) 29 } 30 31 let separator_color = ansi light_cyan 32 let string_color = ansi light_yellow 33 $"($separator_color)//($hostname_fmt)($separator_color)/($username_fmt)($separator_color)/($string_color)cwd=\"($dir)\"" 34} 35 36def create_right_prompt [] { 37 () 38} 39 40# Use nushell functions to define your right and left prompt 41$env.PROMPT_COMMAND = {|| create_left_prompt } 42# FIXME: This default is not implemented in rust code as of 2023-09-08. 43$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } 44 45# The prompt indicators are environmental variables that represent 46# the state of the prompt 47$env.PROMPT_INDICATOR = {|| "/ " } 48$env.PROMPT_INDICATOR_VI_INSERT = {|| "/: " } 49$env.PROMPT_INDICATOR_VI_NORMAL = {|| "/ " } 50$env.PROMPT_MULTILINE_INDICATOR = {|| "/::: " }