From 81a1b591d465f19edb844fe15c8b132802257bd7 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 24 Apr 2011 13:42:15 -0400 Subject: [PATCH] Added history-substring-search plugin key bindings to vi-mode plugin. --- plugins/vi-mode/vi-mode.plugin.zsh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 82b3b549..019fc1d7 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -2,7 +2,7 @@ # FILE: vi-mode.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. # AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.2 +# VERSION: 1.0.3 # ------------------------------------------------------------------------------ @@ -55,8 +55,17 @@ bindkey -M vicmd v edit-command-line # ESC-v to edit in an external editor. bindkey ' ' magic-space bindkey -M vicmd "gg" beginning-of-history bindkey -M vicmd "G" end-of-history -bindkey -M vicmd "k" history-search-backward -bindkey -M vicmd "j" history-search-forward + +# Bind to history substring search plugin if enabled; +# otherwise, bind to built-in ZSH history search. +if (( $+plugins[(er)history-substring-search] )); then + bindkey -M vicmd "k" history-substring-search-backward + bindkey -M vicmd "j" history-substring-search-forward +else + bindkey -M vicmd "k" history-search-backward + bindkey -M vicmd "j" history-search-forward +fi + bindkey -M vicmd "?" history-incremental-search-backward bindkey -M vicmd "/" history-incremental-search-forward