mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[zsh] fix the manpath-caused errors on shell startup once and for all
This commit is contained in:
parent
4b6cf8c56a
commit
e277f19ed3
3 changed files with 10 additions and 5 deletions
|
@ -12,7 +12,7 @@ path_prepend() {
|
|||
fi
|
||||
local var_name="$1"; shift
|
||||
local value; for value in "$@"; do
|
||||
if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then
|
||||
if eval "(( \${${var_name}[(ie)\$value]-1} > \${#${var_name}} ))"; then
|
||||
eval "${var_name}=(\"\$value\" \"\${${var_name}[@]}\")"
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -399,7 +399,7 @@ plugin() {
|
|||
else
|
||||
value="${plugin_dir}/${value}"
|
||||
fi
|
||||
if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then
|
||||
if eval "(( \${${var_name}[(ie)\$value]-1} > \${#${var_name}} ))"; then
|
||||
case "$operator" in
|
||||
prepend) eval "$var_name=(\"\$value\" \${$var_name[@]})" ;;
|
||||
append) eval "$var_name=(\${$var_name[@]} \"\$value\")" ;;
|
||||
|
|
11
zsh/zshrc
11
zsh/zshrc
|
@ -46,15 +46,20 @@ _perf_timer_start "total"
|
|||
fi
|
||||
# }}}
|
||||
|
||||
# For some reason manpath is not always set when logging with ssh for instance.
|
||||
# Let's ensure that it is always set and exported. The additional colon ensures
|
||||
# that the system manpath isn't overwritten (see manpath(1)), though in reality
|
||||
# two colons get added for some reason, which is also valid, but means
|
||||
# something slightly different (again, see manpath(1)). Hope this won't cause
|
||||
# any problems in the future.
|
||||
export MANPATH="$MANPATH:"
|
||||
|
||||
for script in functions options path env plugins aliases completion zle prompt colorscheme; do
|
||||
_perf_timer_start "$script.zsh"
|
||||
source "$ZSH_DOTFILES/$script.zsh"
|
||||
_perf_timer_stop "$script.zsh"
|
||||
done
|
||||
|
||||
# add colon after MANPATH so that it doesn't overwrite system MANPATH
|
||||
MANPATH="$MANPATH:"
|
||||
|
||||
command_exists rbenv && eval "$(rbenv init -)"
|
||||
|
||||
_perf_timer_stop "total"
|
||||
|
|
Loading…
Reference in a new issue