aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-10-02 17:22:55 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-10-02 18:41:39 -0700
commita7727765dcf9fb2ab40e0e3352a5145d337e6133 (patch)
treea9ac57966f60139b0721c3474d0dcaba64b999d0 /share
parent33a76e1f8e386e2bfce1613cc164908f0939bc27 (diff)
Clean up prompt_pwd with the new function -V flag
Also fixes `cd /private` displaying as no path on OS X.
Diffstat (limited to 'share')
-rw-r--r--share/functions/prompt_pwd.fish19
1 files changed, 9 insertions, 10 deletions
diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish
index 991b007b..ce98f6d4 100644
--- a/share/functions/prompt_pwd.fish
+++ b/share/functions/prompt_pwd.fish
@@ -1,14 +1,13 @@
+set -l args_pre
+set -l args_post
switch (uname)
case Darwin
- function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
- echo $PWD | sed -e "s|^$HOME|~|" -e 's|^/private||' -e 's-\([^/.]\)[^/]*/-\1/-g'
- end
+ set args_pre $args_pre -e 's|^/private/|/|'
case 'CYGWIN_*'
- function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
- echo $PWD | sed -e "s|^$HOME|~|" -e 's|^/cygdrive/\(.\)|\1/:|' -e 's-\([^/.]\)[^/]*/-\1/-g' -e 's-^\([^/]\)/:/\?-\u\1:/-'
- end
-case '*'
- function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
- echo $PWD | sed -e "s|^$HOME|~|" -e 's-\([^/.]\)[^/]*/-\1/-g'
- end
+ set args_pre $args_pre -e 's|^/cygdrive/\(.\)|\1/:|'
+ set args_post $args_post -e 's-^\([^/]\)/:/\?-\u\1:/-'
+end
+
+function prompt_pwd -V args_pre -V args_post --description "Print the current working directory, shortened to fit the prompt"
+ echo $PWD | sed -e "s|^$HOME|~|" $args_pre -e 's-\([^/.]\)[^/]*/-\1/-g' $args_post
end