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

Re: Completion style like Vim



Hi all --

On 17 November 2010 22:43, Michael Treibton <mtreibton@xxxxxxxxxxxxxx> wrote:
> Ben --
>
> [ Sorry about the off-list reply -- that's gmail being a pain.
> Hopefully I've sorted that now. ]
>
> On 16 November 2010 21:21, Benjamin R. Haskell <zsh@xxxxxxxxxx> wrote:
>> [attempt two -- not sure if the original ever hit the current zsh-users
>> address]
>>
>> On Tue, 16 Nov 2010, Matt Wozniski wrote:
>>> Michael was describing how it works in command-line mode, not insert
>>> mode.
>
> Thanks, Matt.  Apologies for not being very clear before.   I suppose
> to me it was obvious what I meant by "completion" in terms of ":" mode
> in VIm.  But it looks like we're all singing from the same hymn sheet
> now.  :)
>
>>
>> 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.
>
> Thanks, Ben.  This works exactly as I want, except for one thing --
> the cursor position.
>
> Let's say I have this in my history:
>
> get_foo
> get_bar
>
> ... and assume also that I've got your bindings configured (which I do) as:
>
> bindkey "^[[A" history-beginning-search-backward
> bindkey "^[[B" history-beginning-search-forward
>
> If I type in (at the zsh prompt):
>
> get_
>
> and press the up-arrow key and down-arrow key, the cursor position
> remains after the underscore.  Ideally, I'd love it if the cursor,
> when pressed in either up or down direction could complete the line,
> *and* move to the end of the line, because now, I find myself having
> to do this:
>
> get_
>
> press "up-arrow", and then press "End", because actually I made a typo
> at the end of the line I need to correct and/or was missing some
> options from the command in the first place.  With my previous
> bindings for those arrow-keys, this cursor-position was not a problem.
>
> I have no doubt zsh can do this, and I am learning about it all the
> time -- and I appreciate your help and Matt's so far.  So any insights
> you might have are warmly appreciated.  :)

Was there any ideas on this, may I ask?

TIA,

Michael



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