diff --git a/crates/nu-utils/src/sample_config/default_env.nu b/crates/nu-utils/src/sample_config/default_env.nu index 0269f3ffc..34ea16e4f 100644 --- a/crates/nu-utils/src/sample_config/default_env.nu +++ b/crates/nu-utils/src/sample_config/default_env.nu @@ -1,10 +1,16 @@ # Nushell Environment Config File def create_left_prompt [] { + let home = ($env | get -i (if $nu.os-info.name == "windows" { "USERPROFILE" } else { "HOME" }) | into string) + let dir = ([ + ($env.PWD | str substring 0..($home | str length) | str replace -s $home "~"), + ($env.PWD | str substring ($home | str length)..) + ] | str join) + let path_segment = if (is-admin) { - $"(ansi red_bold)($env.PWD)" + $"(ansi red_bold)($dir)" } else { - $"(ansi green_bold)($env.PWD)" + $"(ansi green_bold)($dir)" } $path_segment