#-- Completion --#
+# shellcheck disable=SC2206
[ -e /usr/local/share/zsh-completions ] && fpath=(/usr/local/share/zsh-completions $fpath)
autoload -U compinit
compinit -u
#-- Like fish prompt --#
-source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
-source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
-source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
+for plugin in "/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"; do
+ if [[ -f "${plugin}" ]]; then
+ source "${plugin}"
+ fi
+done
#-- Key --#
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
-[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" history-substring-search-up
-[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" history-substring-search-down
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
# Normal history display
-#[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
-#[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
+if [[ -f "/usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh" ]]; then
+ source "/usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh"
+ [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" history-substring-search-up
+ [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" history-substring-search-down
+else
+ [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
+ [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
+fi
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
#-- Pass to the path --#
-[[ -d ~/.bin ]] && export PATH="~/.bin:${PATH}"
+[[ -d ~/.bin ]] && export PATH="${HOME}/.bin:${PATH}"
#-- PROMPT --#