mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Clean up prompt_pwd with the new function -V flag
Also fixes `cd /private` displaying as no path on OS X.
This commit is contained in:
parent
33a76e1f8e
commit
a7727765dc
1 changed files with 9 additions and 10 deletions
|
@ -1,14 +1,13 @@
|
||||||
|
set -l args_pre
|
||||||
|
set -l args_post
|
||||||
switch (uname)
|
switch (uname)
|
||||||
case Darwin
|
case Darwin
|
||||||
function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
|
set args_pre $args_pre -e 's|^/private/|/|'
|
||||||
echo $PWD | sed -e "s|^$HOME|~|" -e 's|^/private||' -e 's-\([^/.]\)[^/]*/-\1/-g'
|
|
||||||
end
|
|
||||||
case 'CYGWIN_*'
|
case 'CYGWIN_*'
|
||||||
function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
|
set args_pre $args_pre -e 's|^/cygdrive/\(.\)|\1/:|'
|
||||||
echo $PWD | sed -e "s|^$HOME|~|" -e 's|^/cygdrive/\(.\)|\1/:|' -e 's-\([^/.]\)[^/]*/-\1/-g' -e 's-^\([^/]\)/:/\?-\u\1:/-'
|
set args_post $args_post -e 's-^\([^/]\)/:/\?-\u\1:/-'
|
||||||
end
|
end
|
||||||
case '*'
|
|
||||||
function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
|
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|~|" -e 's-\([^/.]\)[^/]*/-\1/-g'
|
echo $PWD | sed -e "s|^$HOME|~|" $args_pre -e 's-\([^/.]\)[^/]*/-\1/-g' $args_post
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue