From: Zefram <zefram@fysh.org>
To: Andrew Morton <morton@nortelnetworks.com>
Cc: zsh-users@sunsite.auc.dk
Subject: Re: New user questions
Date: Thu, 30 Mar 2000 14:27:37 +0100 (BST) [thread overview]
Message-ID: <E12aez4-0006IZ-00@crucigera.fysh.org> (raw)
In-Reply-To: <38E2C6AA.62D027CD@asiapacificm01.nt.com> from Andrew Morton at "Mar 30, 2000 03:14:50 am"
Andrew Morton wrote:
>prompt> cd /usr/src/li^R
>linux/ linux-2.2.9/ linux-2.3.99-pre3/
>linux-akpm/
>
>So typing ^R in a command line produces a diectory listing of matching
>files and allows you to continue typing.
The widget list-choices does this. Well, actually it produces a list
of possible completions, which are often context dependent (e.g., with
the new completion mechanism enabled, after "kill -" it'll give a list
of signal names). If you actually want strictly a file listing, you'll
have to write your own widget.
list-choices is by default bound to ^D in the vi insert mode keymap, ^D
and = in vi command mode, and ESC ^D in Emacs mode. delete-char-or-list
(^D in Emacs mode) behaves like list-choices when at the end of the line.
>pwold011:~> /sbin/shutdown
>shutdown: must be root.
>pwold011:~> sudo ^W
>
>Here, typing ^W will insert _all_ of the previous line at the prompt.
>(I'd expected get-line to do this, but it just beeps...)
You'll have to write your own widget if you want to do it that way.
Personally I use history expansion to do this. "sudo !!" would
interpolate the previous command. "sudo !!<TAB>" will expand it in
place, while the command is being edited. With magic-space, "sudo !! "
will implicitly expand it when the trailing space is inserted.
>prompt> cp /foo/bar /zot/bop
>prompt> ls /fo^C
>
>Here, ^C will search back through the word history and insert
>'/foo/bar'. If I immediately hit ^C again, it will rub out the 'o/bar'
>and search further back in history, so one can just keep hitting ^C.
_history_complete_word is supposed to do something like this, but I
don't know enough about it.
>This normally generates interrupt. Is there a way of making it
>available to the interactive editor without globally sttying it? (The
>shell would need to restore the intr char when it leaves editing mode).
No. You could temporarily stty it in precmd/preexec, but that has all
sorts of drawbacks.
>I would like to do something similar, but have it walk back through all
>the previous words, not just the final ones on each line:
>
>prompt> echo aaa bbb ccc ddd
>prompt> echo ^O # Expands to echo ddd
>prompt> echo ^O^O # Expands to echo ccc
Again, this is most easily done with history expansion. In the above,
"!:1" will expand to "aaa", "!:2" to "bbb", and so on; "!$" expands to
the last word on the previous line.
>Is there a widget which deletes from the cursor to the end of line?
kill-line does the Emacs thing (delete up to, but not including, NL,
unless that's nothing, in which case it deletes the NL). vi-kill-eol
deletes up to, but not including, NL. Both are bound by default in the
appropriate editing modes.
>All the editor commands define a word separator as a space. Is there a
>way of changing zsh's idea of word separators? I would prefer that it
>consider '/' to be a separator as well.
Look at the parameter WORDCHARS.
>If asynchronous output mucks up the editor output, how to redraw it?
>'clear-screen' will do the job, but I'd prefer it not clear the screen.
redisplay.
-zefram
next prev parent reply other threads:[~2000-03-30 13:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-30 3:14 Andrew Morton
2000-03-30 5:20 ` Chmouel Boudjnah
2000-03-30 5:27 ` Friedrich Dominicus
2000-03-30 11:12 ` Oliver Kiddle
2000-03-30 6:50 ` Andrej Borsenkow
2000-03-30 18:22 ` Chmouel Boudjnah
2000-03-31 6:40 ` Andrew Morton
2000-03-31 7:45 ` Andrej Borsenkow
2000-03-31 10:33 ` Andrew Morton
2000-04-01 17:13 ` Zefram
2000-03-30 6:57 ` Andrej Borsenkow
2000-03-30 13:27 ` Zefram [this message]
2000-03-31 16:18 ` Bart Schaefer
2000-03-31 7:42 Sven Wischnowsky
2000-03-31 10:42 ` Andrew Morton
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=E12aez4-0006IZ-00@crucigera.fysh.org \
--to=zefram@fysh.org \
--cc=morton@nortelnetworks.com \
--cc=zsh-users@sunsite.auc.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).