OSDN Git Service

[update] : Updated zshrc
[alterlinux/alterlinux.git] / channels / plasma / airootfs.any / etc / skel / .zshrc
index b39be43..6ab1e72 100644 (file)
@@ -15,6 +15,7 @@
 
 
 #-- Completion --#
+# shellcheck disable=SC2206
 [ -e /usr/local/share/zsh-completions ] && fpath=(/usr/local/share/zsh-completions $fpath)
 autoload -U compinit
 compinit -u
@@ -26,9 +27,11 @@ export UNZIPOPT=-OCP932
 
 
 #-- 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 --#
@@ -53,16 +56,20 @@ key[PageDown]=${terminfo[knp]}
 [[ -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.
@@ -96,7 +103,7 @@ colors
 
 
 #-- Pass to the path --#
-[[ -d ~/.bin ]] && export PATH="~/.bin:${PATH}"
+[[ -d ~/.bin ]] && export PATH="${HOME}/.bin:${PATH}"
 
 
 #-- PROMPT --#