From 3f1609b384177c48ea939b60461c61fce6bee221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Wed, 21 Feb 2024 19:20:47 +0100 Subject: [PATCH] nushell: add user and host to the prompt --- shell/.config/nushell/env.nu | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/.config/nushell/env.nu b/shell/.config/nushell/env.nu index 0e68ef8..49abac8 100644 --- a/shell/.config/nushell/env.nu +++ b/shell/.config/nushell/env.nu @@ -25,12 +25,13 @@ def create_left_prompt [] { let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) let path_segment = $"($path_color)($dir)" + let userhost = $'(ansi blue_bold)(id -un)@(hostname)(ansi reset)' let base = $path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)" let branch = do { git rev-parse --abbrev-ref HEAD } | complete if $branch.exit_code == 0 { - $"($base) ($separator_color)\((ansi magenta)($branch.stdout | str trim)($separator_color)) " + $"($userhost) ($base) ($separator_color)\((ansi magenta)($branch.stdout | str trim)($separator_color)) " } else { - $base + $'($userhost) ($base) ' } }