Merge branch 'refactor/update_terminal_cwd' into develop
Fixes OS X issues #196, #208, #238.
This commit is contained in:
commit
20d83cade5
45
liquidprompt
45
liquidprompt
@ -114,7 +114,7 @@ case "$LP_OS" in
|
|||||||
echo "$load"
|
echo "$load"
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
FreeBSD)
|
FreeBSD|Darwin|OpenBSD)
|
||||||
_lp_cpu_load () {
|
_lp_cpu_load () {
|
||||||
local bol load eol
|
local bol load eol
|
||||||
# If you have problems with syntax coloring due to the following
|
# If you have problems with syntax coloring due to the following
|
||||||
@ -124,21 +124,6 @@ case "$LP_OS" in
|
|||||||
echo "$load"
|
echo "$load"
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
Darwin)
|
|
||||||
_lp_cpu_load () {
|
|
||||||
local bol load eol
|
|
||||||
read bol load eol <<<$( LANG=C sysctl -n vm.loadavg )
|
|
||||||
echo "$load"
|
|
||||||
}
|
|
||||||
LP_DWIN_KERNEL_REL_VER=$(uname -r | cut -d . -f 1)
|
|
||||||
;;
|
|
||||||
OpenBSD)
|
|
||||||
_lp_cpu_load() {
|
|
||||||
local bol load eol
|
|
||||||
read one two three <<< `sysctl -n vm.loadavg`
|
|
||||||
echo "$load"
|
|
||||||
}
|
|
||||||
;;
|
|
||||||
SunOS)
|
SunOS)
|
||||||
_lp_cpu_load () {
|
_lp_cpu_load () {
|
||||||
LANG=C uptime | awk '{print substr($10,0,length($10))}'
|
LANG=C uptime | awk '{print substr($10,0,length($10))}'
|
||||||
@ -372,6 +357,20 @@ else
|
|||||||
LP_BRACKET_CLOSE="${LP_MARK_BRACKET_CLOSE}"
|
LP_BRACKET_CLOSE="${LP_MARK_BRACKET_CLOSE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# update_terminal_cwd is a shell function available on MacOS X Lion that
|
||||||
|
# will update an icon of the directory displayed in the title of the terminal
|
||||||
|
# window.
|
||||||
|
# See http://hints.macworld.com/article.php?story=20110722211753852
|
||||||
|
if [[ "$TERM_PROGRAM" == Apple_Terminal ]] && command -v update_terminal_cwd >/dev/null; then
|
||||||
|
_LP_TERM_UPDATE_DIR=update_terminal_cwd
|
||||||
|
# Remove "update_terminal_cwd; " that has been add by Apple in /et/bashrc.
|
||||||
|
# See issue #196
|
||||||
|
PROMPT_COMMAND="${PROMPT_COMMAND//update_terminal_cwd; /}"
|
||||||
|
else
|
||||||
|
_LP_TERM_UPDATE_DIR=:
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Escape the given strings
|
# Escape the given strings
|
||||||
# Must be used for all strings that may comes from remote sources,
|
# Must be used for all strings that may comes from remote sources,
|
||||||
# like VCS branch names
|
# like VCS branch names
|
||||||
@ -1602,15 +1601,8 @@ _lp_set_prompt()
|
|||||||
local IFS="$(echo -e ' \t')
|
local IFS="$(echo -e ' \t')
|
||||||
" # space, tab, LF
|
" # space, tab, LF
|
||||||
|
|
||||||
# execute the old prompt if not on Mac OS X (Mountain) Lion
|
# execute the old prompt
|
||||||
case "$LP_OS" in
|
eval "$LP_OLD_PROMPT_COMMAND"
|
||||||
Linux|FreeBSD|OpenBSD|SunOS) $LP_OLD_PROMPT_COMMAND ;;
|
|
||||||
Darwin)
|
|
||||||
case "$(LP_DWIN_KERNEL_REL_VER)" in
|
|
||||||
11|12) update_terminal_cwd ;;
|
|
||||||
*) $LP_OLD_PROMPT_COMMAND ;;
|
|
||||||
esac ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# left of main prompt: space at right
|
# left of main prompt: space at right
|
||||||
LP_JOBS="$(_lp_sr "$(_lp_jobcount_color)")"
|
LP_JOBS="$(_lp_sr "$(_lp_jobcount_color)")"
|
||||||
@ -1633,6 +1625,9 @@ _lp_set_prompt()
|
|||||||
LP_RUNTIME=$(_lp_sl "$(_lp_runtime)")
|
LP_RUNTIME=$(_lp_sl "$(_lp_runtime)")
|
||||||
|
|
||||||
if [[ "$LP_OLD_PWD" != "LP:$PWD" ]]; then
|
if [[ "$LP_OLD_PWD" != "LP:$PWD" ]]; then
|
||||||
|
# Update directory icon for MacOS X
|
||||||
|
$_LP_TERM_UPDATE_DIR
|
||||||
|
|
||||||
LP_VCS=""
|
LP_VCS=""
|
||||||
LP_VCS_TYPE=""
|
LP_VCS_TYPE=""
|
||||||
# LP_HOST is a global set at load time
|
# LP_HOST is a global set at load time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user