zsh-users
 help / color / mirror / code / Atom feed
* vi mode and history-search key binding
@ 2006-05-28  3:39 William Scott
  2006-05-28  5:17 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: William Scott @ 2006-05-28  3:39 UTC (permalink / raw)
  To: zsh-users

Hi:

Among my favorite keybindings are

      bindkey '\e[A'    history-search-backward
      bindkey '\e[B'   history-search-forward


Since I use vim instead of emacs, I thought I ought to at least try  
vi keybindings, although I think my brain is too hard-wired to make  
the switch.  In any case, the up and down arrows would be of more use  
having this altered binding. I tried this:

      bindkey '\e[A'  vi-history-search-backward
      bindkey '\e[B'  vi-history-search-forward

It appears to have no effect. Is this intended?

Thanks.

Bill Scott



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: vi mode and history-search key binding
  2006-05-28  3:39 vi mode and history-search key binding William Scott
@ 2006-05-28  5:17 ` Bart Schaefer
  2006-05-28  6:47   ` William Scott
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2006-05-28  5:17 UTC (permalink / raw)
  To: zsh-users

On May 27,  8:39pm, William Scott wrote:
}
}       bindkey '\e[A'  vi-history-search-backward
}       bindkey '\e[B'  vi-history-search-forward

This binds those keys in the main keymap, which by default is the emacs
keymap.  Have you somewhere earlier in your startup files executed a
"bindkey -v" command?  If you did, then those bind keys in the viins
keymap (insert mode), not the vicmd keymap (command mode).  In which
mode are you attempting to invoke the search?

} It appears to have no effect. Is this intended?

The effect you should see is that a quetion-mark (for backward) or slash
(for forward) prompt appears below the PS1 prompt; you then enter the
string to search for.  If that doesn't happen, you've probably bound
the keys in the wrong keymap.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: vi mode and history-search key binding
  2006-05-28  5:17 ` Bart Schaefer
@ 2006-05-28  6:47   ` William Scott
  0 siblings, 0 replies; 3+ messages in thread
From: William Scott @ 2006-05-28  6:47 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

B

On Sat, 27 May 2006, Bart Schaefer wrote:

> On May 27,  8:39pm, William Scott wrote:
> }
> }       bindkey '\e[A'  vi-history-search-backward
> }       bindkey '\e[B'  vi-history-search-forward
>
> This binds those keys in the main keymap, which by default is the emacs
> keymap.  Have you somewhere earlier in your startup files executed a
> "bindkey -v" command?  If you did, then those bind keys in the viins
> keymap (insert mode), not the vicmd keymap (command mode).  In which
> mode are you attempting to invoke the search?
>
> } It appears to have no effect. Is this intended?
>
> The effect you should see is that a quetion-mark (for backward) or slash
> (for forward) prompt appears below the PS1 prompt; you then enter the
> string to search for.  If that doesn't happen, you've probably bound
> the keys in the wrong keymap.
>


Sorry, I misunderstood what vi-history-search-forward, etc, does.

         bindkey -v
         bindkey '\e[A'  history-search-backward
         bindkey '\e[B'  history-search-forward

gives me the desired behavior.


Thanks for pointing out what should have been obvious.  (I just issued
bindkey -v on the command line to experiment. I'm not sure what it says
about the ossified state of my brain, but even as a vi(m) user, I can't
seem to break the emacs keybinding habbits in the shell. It was far easier
to switch from tcsh to zsh. I'll give it the weekend.)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-28  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-28  3:39 vi mode and history-search key binding William Scott
2006-05-28  5:17 ` Bart Schaefer
2006-05-28  6:47   ` William Scott

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).