From 8343418e73f448bfca67834833f6e637c3bf7802 Mon Sep 17 00:00:00 2001 From: Luca Filipozzi Date: Sun, 27 Oct 2019 22:15:21 -0700 Subject: [PATCH] improve $HOME detection for superuser on macOS On macOS, root's $HOME is '/var/root' but '/var' is a symlink to '/var/private'. Consequently, $HOME ('/var/'root') never matches a normalized $PWD ('/var/private/root') and '~' is never displayed. --- fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index 3fd4334..f0800b1 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -359,7 +359,7 @@ function __bobthefish_path_segment -S -a segment_dir -d 'Display a shortened for switch "$segment_dir" case / set directory '/' - case "$HOME" + case (builtin realpath "$HOME") set directory '~' case '*' set parent (__bobthefish_pretty_parent "$segment_dir")