aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/prompt_pwd.fish
diff options
context:
space:
mode:
Diffstat (limited to 'share/functions/prompt_pwd.fish')
-rw-r--r--share/functions/prompt_pwd.fish20
1 files changed, 10 insertions, 10 deletions
diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish
index 991b007b..921ee429 100644
--- a/share/functions/prompt_pwd.fish
+++ b/share/functions/prompt_pwd.fish
@@ -1,14 +1,14 @@
+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"
+ set -l realhome ~
+ echo $PWD | sed -e "s|^$realhome|~|" $args_pre -e 's-\([^/.]\)[^/]*/-\1/-g' $args_post
end