Disable vcs_info if the function is not loaded
[grml-etc-core.git] / etc / zsh / zshrc
index 1f8cdaa..b8c950e 100644 (file)
@@ -625,14 +625,18 @@ bindkey "\e[1;5D" backward-word
 bindkey '^[[1;3C' forward-word
 bindkey '^[[1;3D' backward-word
 
-bindkey '^xp'   history-beginning-search-backward
-bindkey '^xP'   history-beginning-search-forward
-bindkey "\e[5~" history-beginning-search-backward #PageUp
-bindkey "\e[6~" history-beginning-search-forward  #PageDown
+# Search backward in the history for a line beginning with the current
+# line up to the cursor and move the cursor to the end of the line then
+zle -N history-beginning-search-backward-end history-search-end
+zle -N history-beginning-search-forward-end  history-search-end
+bindkey '^xp'   history-beginning-search-backward-end
+bindkey '^xP'   history-beginning-search-forward-end
+bindkey "\e[5~" history-beginning-search-backward-end # PageUp
+bindkey "\e[6~" history-beginning-search-forward-end  # PageDown
+
 # bindkey -s '^L' "|less\n"             # ctrl-L pipes to less
 # bindkey -s '^B' " &\n"                # ctrl-B runs it in the background
 
-
 # insert unicode character
 # usage example: 'ctrl-x i' 00A7 'ctrl-x i' will give you an ยง
 # See for example http://unicode.org/charts/ for unicode characters code
@@ -1301,7 +1305,7 @@ function info_print () {
 is4 && [[ $NOPRECMD -eq 0 ]] && precmd () {
     [[ $NOPRECMD -gt 0 ]] && return 0
     # update VCS information
-    vcs_info
+    (( ${+functions[vcs_info]} )) && vcs_info
 
     if [[ $TERM == screen* ]] ; then
         if [[ -n ${vcs_info_msg_1_} ]] ; then
@@ -2062,8 +2066,15 @@ if [[ -d /etc/init.d || -d /etc/service ]] ; then
         fi
     }
 
+    _grmlinitd() {
+        local -a scripts
+        scripts=( /etc/init.d/*(x:t) )
+        _describe "service startup script" scripts
+    }
+
     for i in Start Restart Stop Force-Reload Reload ; do
         eval "$i() { __start_stop $i \"\$1\" \"\$2\" ; }"
+        compdef _grmlinitd $i
     done
 fi