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