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