Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion style like Vim



[attempt two -- not sure if the original ever hit the current zsh-users 
address]

On Tue, 16 Nov 2010, Matt Wozniski wrote:

> On Tue, Nov 16, 2010 at 3:09 PM, Benjamin R. Haskell wrote:
> > On Tue, 16 Nov 2010, Michael Treibton wrote:
> > 
> > > Hi all,
> > > 
> > > I'm wondering how i can get vim-like completion with zsh, and even 
> > > if it's possible?
> > > 
> > > For those who don't know, vim allows completion to happen on one 
> > > line, so if I have entered the following commands:
> > > 
> > > foobar hello
> > > bar baz hello
> > > zsh is cool
> > > zsh is really cool
> > > 
> > > ... and I were to type in:
> > > 
> > > zsh is
> > > 
> > > and then press the up or down arrow keys, I would see as 
> > > completion:
> > > 
> > > zsh is cool
> > > zsh is really cool
> > 
> > That's not how my Vim completion works. Â(Big fan of the popupmenu 
> > and supertab.) ÂI guess you like i_CTRL-X_CTRL-L? ÂI much prefer 
> > i_CTRL-X_CTRL-O for the general case, falling back to 
> > i_CTRL-X_CTRL-I. (Both of which I access via '<Tab>'.)
> 
> Michael was describing how it works in command-line mode, not insert 
> mode.
> 

Ah, yep.  There's the disconnect.  I do too much with Vim's 
insert-completion to think of that as "completion".

In any case, the following seems to work like Vim's command-line 
completion:

bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward

^[[A == up arrow, ^[[B == down.  Sounds like you want ^n and ^p, too.

-- 
Best,
Ben


Messages sorted by: Reverse Date, Date, Thread, Author