diff options
author | Emily Eisenberg <xymostech@gmail.com> | 2012-07-06 01:41:07 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-07-06 14:46:50 -0700 |
commit | d07e78c59a5e90f3a4cd5af2a1ec3d84eff94fe4 (patch) | |
tree | 48a17406e81148a8bcac92a0e63a8b92a3c93c84 /share | |
parent | c45479a6e5cd9dba7b212c98e22d5adc879d5b03 (diff) |
Make prompt_pwd make a lot more sense
Remove the case statements, which were handled by the sed blocks anyway
Move around the '/' character in the regex, so only one regex is needed
Fix a bug where '/' is output as '//'
Diffstat (limited to 'share')
-rw-r--r-- | share/functions/prompt_pwd.fish | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish index 34b2e8ee..cbc94729 100644 --- a/share/functions/prompt_pwd.fish +++ b/share/functions/prompt_pwd.fish @@ -1,22 +1,10 @@ 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 -n -e 's-.*/\.\{0,1\}.\([^/]*\)-\1-p' - else - echo '~' - end + echo $PWD | sed -e "s|^$HOME|~|" -e 's|^/private||' -e 's-\([^/]\)[^/]*/-\1/-g' end else function prompt_pwd --description "Print the current working directory, shortend to fit the prompt" - switch "$PWD" - case "$HOME" - echo '~' - - case '*' - printf "%s" (echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g') - echo $PWD|sed -n -e 's-.*/\.\{0,1\}.\([^/]*\)-\1-p' - end + echo $PWD | sed -e "s|^$HOME|~|" -e 's-\([^/]\)[^/]*/-\1/-g' end end |