zsh-workers
 help / color / mirror / code / Atom feed
* bind key information - filename completion
@ 2013-09-03 15:47 Cary Lewis
  2013-09-03 15:56 ` Bart Schaefer
  2013-09-03 15:58 ` Peter Stephenson
  0 siblings, 2 replies; 3+ messages in thread
From: Cary Lewis @ 2013-09-03 15:47 UTC (permalink / raw)
  To: zsh-workers

I want to start using the zsh, but my arrow keys (for legacy reasons)
are not configured in a standard way, and I can't use them to navigate
the list of files that appears when when attempt to use the filename
completion features of the shell.

My question is this: Can I someone configure zsh to use vi style of
navigation (j is down, k is up, h is left, l is right)?

I can't just change the key bindings:

 bindkey "j" up-line-or-history

because then the j character doesn't work.

So is there a way to dynamically change the key bindings when the list
of files is displayed, and automatically change them back?

Thanks for any help you can provide.


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

* Re: bind key information - filename completion
  2013-09-03 15:47 bind key information - filename completion Cary Lewis
@ 2013-09-03 15:56 ` Bart Schaefer
  2013-09-03 15:58 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2013-09-03 15:56 UTC (permalink / raw)
  To: Cary Lewis, zsh-workers

On Sep 3, 11:47am, Cary Lewis wrote:
}
} My question is this: Can I someone configure zsh to use vi style of
} navigation (j is down, k is up, h is left, l is right)?

It should work to do this:

bindkey -M menuselect j down-line-or-history
bindkey -M menuselect k up-line-or-history
bindkey -M menuselect l forward-char
bindkey -M menuselect h backward-char

You may also need:

bindkey -M listscroll j down-line-or-history
bindkey -M listscroll k up-line-or-history

Both of these keymaps are explained under "The zsh/complist Module" in
the manual.


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

* Re: bind key information - filename completion
  2013-09-03 15:47 bind key information - filename completion Cary Lewis
  2013-09-03 15:56 ` Bart Schaefer
@ 2013-09-03 15:58 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2013-09-03 15:58 UTC (permalink / raw)
  To: Cary Lewis, zsh-workers

On Tue, 03 Sep 2013 11:47:08 -0400
Cary Lewis <cary.lewis@gmail.com> wrote:
> I want to start using the zsh, but my arrow keys (for legacy reasons)
> are not configured in a standard way, and I can't use them to navigate
> the list of files that appears when when attempt to use the filename
> completion features of the shell.
> 
> My question is this: Can I someone configure zsh to use vi style of
> navigation (j is down, k is up, h is left, l is right)?
> 
> I can't just change the key bindings:
> 
>  bindkey "j" up-line-or-history
> 
> because then the j character doesn't work.
> 
> So is there a way to dynamically change the key bindings when the list
> of files is displayed, and automatically change them back?

If I'm following what this is for, it's as simple as


zmodload zsh/complist
bindkey -M menuselect j up-line-or-history
bindkey -M menuselect k down-line-or-history
bindkey -M menuselect h backward-char
bindkey -M menuselect l forward-char


The only disadvantage would appear to be the patently obvious one, that
you can't use those keys to exit the list and immediately insert a
character.

(This is really more of a zsh-users things.)

pws


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

end of thread, other threads:[~2013-09-03 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-03 15:47 bind key information - filename completion Cary Lewis
2013-09-03 15:56 ` Bart Schaefer
2013-09-03 15:58 ` Peter Stephenson

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).