* Return to the prompt
@ 2004-07-01 5:03 Fabiano Sidler
2004-07-01 5:18 ` Philippe Troin
0 siblings, 1 reply; 6+ messages in thread
From: Fabiano Sidler @ 2004-07-01 5:03 UTC (permalink / raw)
To: zsh-users
Hello List!
I did the following:
$ listdir() { ls -l }
$ zle -N listdir
$ bindkey '^V' listdir
If then I press ^V, the directory is listed, but I have to press a key in
order to get my command line back. I tried wierd hacks with 'zle -R' or
'zle -M' for that, but there was no solution. Any hints on that?
Thanks!
Fips
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Return to the prompt
2004-07-01 5:03 Return to the prompt Fabiano Sidler
@ 2004-07-01 5:18 ` Philippe Troin
2004-07-01 6:46 ` Fabiano Sidler
2004-07-01 9:04 ` Oliver Kiddle
0 siblings, 2 replies; 6+ messages in thread
From: Philippe Troin @ 2004-07-01 5:18 UTC (permalink / raw)
To: Fabiano Sidler; +Cc: zsh-users
Fabiano Sidler <fabianosidler@swissonline.ch> writes:
> Hello List!
>
> I did the following:
>
> $ listdir() { ls -l }
> $ zle -N listdir
> $ bindkey '^V' listdir
>
> If then I press ^V, the directory is listed, but I have to press a key in
> order to get my command line back. I tried wierd hacks with 'zle -R' or
> 'zle -M' for that, but there was no solution. Any hints on that?
listdir() { ls -l; zle redisplay }
should do the trick.
Phil.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Return to the prompt
2004-07-01 5:18 ` Philippe Troin
@ 2004-07-01 6:46 ` Fabiano Sidler
2004-07-01 9:04 ` Oliver Kiddle
1 sibling, 0 replies; 6+ messages in thread
From: Fabiano Sidler @ 2004-07-01 6:46 UTC (permalink / raw)
To: zsh-users
Philippe Troin <phil@fifi.org> writes:
> Fabiano Sidler <fabianosidler@swissonline.ch> writes:
> > $ listdir() { ls -l }
> > $ zle -N listdir
> > $ bindkey '^V' listdir
> >
> > If then I press ^V, the directory is listed, but I have to press a key in
> > order to get my command line back. I tried wierd hacks with 'zle -R' or
> > 'zle -M' for that, but there was no solution. Any hints on that?
>
> listdir() { ls -l; zle redisplay }
>
> should do the trick.
>
> Phil.
Doh!:(
I remarked that widget, but I tought, this can't be it!
PEBKAC...
Thanks for your fast answer!
Greetings,
Fips
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Return to the prompt
2004-07-01 5:18 ` Philippe Troin
2004-07-01 6:46 ` Fabiano Sidler
@ 2004-07-01 9:04 ` Oliver Kiddle
2004-07-01 9:53 ` Peter Stephenson
2004-07-01 11:05 ` Fabiano Sidler
1 sibling, 2 replies; 6+ messages in thread
From: Oliver Kiddle @ 2004-07-01 9:04 UTC (permalink / raw)
To: zsh-users
Philippe Troin wrote:
> > If then I press ^V, the directory is listed, but I have to press a key in
> > order to get my command line back. I tried wierd hacks with 'zle -R' or
> > 'zle -M' for that, but there was no solution. Any hints on that?
>
> listdir() { ls -l; zle redisplay }
Problem with that is the beginning of the ls listing can get a little
mixed up with what is currently on the command line.
I would use:
bindkey -s '^V' $'\eqls -l\n'
Note that that relies on my also having:
bindkey '^[q' push-input
Oliver
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Return to the prompt
2004-07-01 9:04 ` Oliver Kiddle
@ 2004-07-01 9:53 ` Peter Stephenson
2004-07-01 11:05 ` Fabiano Sidler
1 sibling, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2004-07-01 9:53 UTC (permalink / raw)
To: zsh-users
Oliver Kiddle wrote:
> Philippe Troin wrote:
> > listdir() { ls -l; zle redisplay }
>
> Problem with that is the beginning of the ls listing can get a little
> mixed up with what is currently on the command line.
>
> I would use:
> bindkey -s '^V' $'\eqls -l\n'
>
> Note that that relies on my also having:
> bindkey '^[q' push-input
>
> Oliver
The following widget seems to give a reasonable combination of features.
The difference between zle -R and zle redisplay isn't that obvious. You use
zle -R to make editing changes visible, and zle redisplay when it's
necessary to reshow everything completely.
listdir() {
zle push-input # Save the input for later
zle -R # Show new line with no input
print # Clear the line with the prompt
ls -l # Show the listing
zle redisplay # Redisplay the entire line
zle get-line # Get back the input
}
(It doesn't seem to beep if there's no input to push and get back, but I
have so many guards to stop the damn thing beeping that I can't be
sure. If it does, extra protection of the form (( ${#BUFFER} )) is
necessary.)
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Return to the prompt
2004-07-01 9:04 ` Oliver Kiddle
2004-07-01 9:53 ` Peter Stephenson
@ 2004-07-01 11:05 ` Fabiano Sidler
1 sibling, 0 replies; 6+ messages in thread
From: Fabiano Sidler @ 2004-07-01 11:05 UTC (permalink / raw)
To: zsh-users
Oliver Kiddle wrote:
> Philippe Troin wrote:
>>> If then I press ^V, the directory is listed, but I have to press a key in
>>> order to get my command line back. I tried wierd hacks with 'zle -R' or
>>> 'zle -M' for that, but there was no solution. Any hints on that?
>>
>> listdir() { ls -l; zle redisplay }
>
> Problem with that is the beginning of the ls listing can get a little
> mixed up with what is currently on the command line.
>
> I would use:
> bindkey -s '^V' $'\eqls -l\n'
>
> Note that that relies on my also having:
> bindkey '^[q' push-input
>
> Oliver
Yes, that's also nice! ;) Thanks for the idea.
Fips
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-07-01 11:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-01 5:03 Return to the prompt Fabiano Sidler
2004-07-01 5:18 ` Philippe Troin
2004-07-01 6:46 ` Fabiano Sidler
2004-07-01 9:04 ` Oliver Kiddle
2004-07-01 9:53 ` Peter Stephenson
2004-07-01 11:05 ` Fabiano Sidler
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).