zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.dk
Subject: Re: Return to the prompt
Date: Thu, 01 Jul 2004 10:53:57 +0100	[thread overview]
Message-ID: <200407010953.i619rvBb010241@news01.csr.com> (raw)
In-Reply-To: "Oliver Kiddle"'s message of "Thu, 01 Jul 2004 11:04:17 +0200." <21161.1088672657@trentino.logica.co.uk>

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
**********************************************************************


  reply	other threads:[~2004-07-01  9:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-01  5:03 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 [this message]
2004-07-01 11:05     ` Fabiano Sidler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407010953.i619rvBb010241@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).