From 529d410bec1f2d3c455840db7d52663d52b34469 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Thu, 21 Jun 2012 20:32:07 -0700 Subject: [PATCH] Fix prompt_cwd on darwin systems when $PWD is "/private" When $PWD is "/private", the prompt was printing "rivate". Skip the "/private" stripping if there's nothing after it. Prevent "/private" from being stripped anywhere but the beginning of the PWD. Fixes #173 --- share/functions/prompt_pwd.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish index 7f892c700..0396fd047 100644 --- a/share/functions/prompt_pwd.fish +++ b/share/functions/prompt_pwd.fish @@ -2,7 +2,7 @@ if test (uname) = Darwin function prompt_pwd --description "Print the current working directory, shortend to fit the prompt" if test "$PWD" != "$HOME" - printf "%s" (echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g') + printf "%s" (echo $PWD|sed -e 's|^/private\(/.\{1,\}\)|\1|' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g') echo $PWD|sed -e 's-.*/\.\{0,1\}[^/]\([^/]*$\)-\1-' else echo '~'