From: Dominik Vogt <VOGT@de.ibm.com>
To: zsh-users@zsh.org
Subject: searching words in history similar to insert-last-word
Date: Thu, 14 Mar 2013 13:06:39 +0100 [thread overview]
Message-ID: <OFB4919E60.BB31A680-ONC1257B2E.0040C2F4-C1257B2E.00428ABB@de.ibm.com> (raw)
Hi folks,
I'm looking for a way to complete the last word I'm typing on the command
line by doing a history search. With Alt-. (insert-last-word) I can browse
through the last words of the previous lines, but I'm looking for something
more clever. My use case is this:
I'm copying files to remote machines with scp, e.g.
$ scp foo user@machine1.domain:
$ scp bar baz .* user@machine2.domain:
I'd like to be able to simplify this by being able to type
$ scp xyz user@<SHIFT-UP><SHIFT-UP>
to yield
$ scp xyz user@machine1.domain:
When I press <SHIFT-UP> repeatedly, zsh should replace the last word on the
line with words from the history that begin with "user@". The function
name might be something like "beginning-search-up". Some extra features
or options would be:
1. Ignore the first word of each line but look through all other words
on each history line.
2. (If the word that is to be completed is the first word on the line,
only consider the first word of all history lines.)
3. Allow searching in the other direction with <SHIFT-DOWN>.
--
And as a related but seperate issue:
How can I make a function that works like insert-last-word but works in the
opposite direction (insert-next-word). This would of course only be
usefull if I use insert-last-word first.
Ciao
Dominik ^_^ ^_^
next reply other threads:[~2013-03-14 12:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-14 12:06 Dominik Vogt [this message]
[not found] ` <CAHYJk3SkuwnHAWhe_NFJpGT-VpBhO1CSOTiP-_mYzXnWb=bPnA@mail.gmail.com>
2013-03-14 12:17 ` Mikael Magnusson
2013-03-14 12:32 Dominik Vogt
2013-03-14 18:12 ` Bart Schaefer
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=OFB4919E60.BB31A680-ONC1257B2E.0040C2F4-C1257B2E.00428ABB@de.ibm.com \
--to=vogt@de.ibm.com \
--cc=zsh-users@zsh.org \
/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).