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