zsh-users
 help / color / mirror / code / Atom feed
* Command Completion and up-arrow
@ 2008-10-28 22:49 Corwin Zechar
  2008-10-28 22:56 ` Mikael Magnusson
  0 siblings, 1 reply; 5+ messages in thread
From: Corwin Zechar @ 2008-10-28 22:49 UTC (permalink / raw)
  To: zsh-users

Hi -

In tcsh, when I put the following lines in my .tcshrc:

        bindkey -k up history-search-backward
        bindkey -k down history-search-forward

The effect is that when I type one or more characters and press 
up-arrow, tcsh attempts to match commands in my command history to the 
characters I have typed.

Is there a way to do this in zsh?

Do I need to write a completion function?

Thanks


Corwin


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

* Re: Command Completion and up-arrow
  2008-10-28 22:49 Command Completion and up-arrow Corwin Zechar
@ 2008-10-28 22:56 ` Mikael Magnusson
  2008-10-28 23:14   ` Corwin Zechar
  0 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2008-10-28 22:56 UTC (permalink / raw)
  To: Corwin Zechar; +Cc: zsh-users

2008/10/28 Corwin Zechar <czech@sonic.net>:
> Hi -
>
> In tcsh, when I put the following lines in my .tcshrc:
>
>       bindkey -k up history-search-backward
>       bindkey -k down history-search-forward
>
> The effect is that when I type one or more characters and press up-arrow,
> tcsh attempts to match commands in my command history to the characters I
> have typed.
>
> Is there a way to do this in zsh?

yes

> Do I need to write a completion function?

no

Just use the same commands as you used in tcsh, but drop the -k and
you have to write the literal code for "up" and "down", ie something
like ^[[A and ^[[B.

-- 
Mikael Magnusson


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

* Re: Command Completion and up-arrow
  2008-10-28 22:56 ` Mikael Magnusson
@ 2008-10-28 23:14   ` Corwin Zechar
  2008-10-28 23:34     ` Anthony R Fletcher
  0 siblings, 1 reply; 5+ messages in thread
From: Corwin Zechar @ 2008-10-28 23:14 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh-users

[-- Attachment #1: Type: text/html, Size: 1455 bytes --]

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

* Re: Command Completion and up-arrow
  2008-10-28 23:14   ` Corwin Zechar
@ 2008-10-28 23:34     ` Anthony R Fletcher
  2008-10-29 14:57       ` Corwin Zechar
  0 siblings, 1 reply; 5+ messages in thread
From: Anthony R Fletcher @ 2008-10-28 23:34 UTC (permalink / raw)
  To: Corwin Zechar; +Cc: Mikael Magnusson, zsh-users

You might also try

	bindkey "^N" history-beginning-search-forward
	bindkey "^P" history-beginning-search-backward

This searches on the complete string to the left of the cursor and not
just the first work on the command line.

		Anthony

On 28 Oct 2008 at 16:14:27, Corwin Zechar wrote:
> Thanks very much Mikael.
> 
> The syntax required is:
> 
>         bindkey '^[[A' up-line-or-search
>         bindkey '^[[B' down-line-or-search
> 
> 
> Corwin
> 
> Mikael Magnusson wrote:
> 
>     2008/10/28 Corwin Zechar <czech@sonic.net>:
> 
> 
>         Hi -
> 
>         In tcsh, when I put the following lines in my .tcshrc:
> 
>               bindkey -k up history-search-backward
>               bindkey -k down history-search-forward
> 
>         The effect is that when I type one or more characters and press up-arrow,
>         tcsh attempts to match commands in my command history to the characters I
>         have typed.
> 
>         Is there a way to do this in zsh?
> 
> 
>     yes
> 
> 
> 
>         Do I need to write a completion function?
> 
> 
>     no
> 
>     Just use the same commands as you used in tcsh, but drop the -k and
>     you have to write the literal code for "up" and "down", ie something
>     like ^[[A and ^[[B.
> 
> 
> 
> 

-- 
Anthony R Fletcher        
  Room 2033, Building 12A,        http://dcb.cit.nih.gov/~arif
  National Institutes of Health,  arif@mail.nih.gov
  12A South Drive, Bethesda,      Phone: (+1) 301 402 1741.
  MD 20892-5624, USA.


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

* Re: Command Completion and up-arrow
  2008-10-28 23:34     ` Anthony R Fletcher
@ 2008-10-29 14:57       ` Corwin Zechar
  0 siblings, 0 replies; 5+ messages in thread
From: Corwin Zechar @ 2008-10-29 14:57 UTC (permalink / raw)
  To: arif, Mikael Magnusson, zsh-users

[-- Attachment #1: Type: text/html, Size: 1927 bytes --]

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

end of thread, other threads:[~2008-10-29 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-28 22:49 Command Completion and up-arrow Corwin Zechar
2008-10-28 22:56 ` Mikael Magnusson
2008-10-28 23:14   ` Corwin Zechar
2008-10-28 23:34     ` Anthony R Fletcher
2008-10-29 14:57       ` Corwin Zechar

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