From 1a93cbba1e6ff0c1c5767b529a42f444b985b7dc Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Fri, 22 Jun 2012 18:35:44 -0700 Subject: Bring prompt_pwd under Darwin to parity with non-Darwin The echo command to print the last path segment got a couplel of fixes, but these fixes were only applied to the non-Darwin version. Copy these fixes over to the Darwin version. Notably, this makes `/` stop displaying as `//`. --- share/functions/prompt_pwd.fish | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'share/functions/prompt_pwd.fish') diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish index 0396fd04..34b2e8ee 100644 --- a/share/functions/prompt_pwd.fish +++ b/share/functions/prompt_pwd.fish @@ -3,7 +3,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\(/.\{1,\}\)|\1|' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g') - echo $PWD|sed -e 's-.*/\.\{0,1\}[^/]\([^/]*$\)-\1-' + echo $PWD|sed -n -e 's-.*/\.\{0,1\}.\([^/]*\)-\1-p' else echo '~' end @@ -20,4 +20,3 @@ else end end end - -- cgit v1.2.3