Simplified unwanted tilde expansion handling

The idea comes from https://github.com/edkolev/promptline.vim/pull/11
This commit is contained in:
Linus Wallgren 2014-06-02 23:34:46 +02:00 committed by Olivier Mengué
parent dc7be2540d
commit 5813a710fc

View File

@ -52,8 +52,6 @@
# Issue #161: do not load if not an interactive shell # Issue #161: do not load if not an interactive shell
test -z "$TERM" -o "x$TERM" = xdumb && return test -z "$TERM" -o "x$TERM" = xdumb && return
_LP_SHELL_bash_42=false
# Check for recent enough version of bash. # Check for recent enough version of bash.
if test -n "$BASH_VERSION" -a -n "$PS1" ; then if test -n "$BASH_VERSION" -a -n "$PS1" ; then
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
@ -62,10 +60,6 @@ if test -n "$BASH_VERSION" -a -n "$PS1" ; then
return return
fi fi
if [[ $BASH_VERSION == 4.2.* ]]; then
_LP_SHELL_bash_42=true
fi
unset bash bmajor bminor unset bash bmajor bminor
_LP_SHELL_bash=true _LP_SHELL_bash=true
@ -539,11 +533,8 @@ unset _lp_connection
_lp_get_home_tilde_collapsed() _lp_get_home_tilde_collapsed()
{ {
if $_LP_SHELL_bash_42; then local tilde="~"
echo ${PWD/#$HOME/~} echo ${PWD/#$HOME/$tilde}
else
echo ${PWD/#$HOME/'~'}
fi
} }
# Shorten the path of the current working directory # Shorten the path of the current working directory