Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: searching words in history similar to insert-last-word
- X-seq: zsh-users 17696
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: searching words in history similar to insert-last-word
- Date: Thu, 14 Mar 2013 13:17:29 +0100
- Cc: Dominik Vogt <VOGT@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=SmcalKHFZum7EaKqgl9xaZmhza871gmI+AvJ6uqCQBc=; b=qkmf6V+Rm1lJpc9GmlIZ6leaBCVfye+8Ssql92aOxt/Zx/rvQL2L4d0Q1wveECxSzX KCTHvbBvdIq9EfKBsnJvSJhyNjT6fTJqS6/XwQOBmPk0Toe9stzaLwPozAtzGRlCW6gM Lxyaw4kz8SuYL9AproktJCXT8P3+lb3EbxOBCobJtc4FNItLssuykuAI0VjbBwN/AmO1 7DAKGRdWTdVstRY6QwUWzZjceprTeBm7w4YEHpt+t969AWMhkgZRnX1nLRX9/YWxU6RS LICy4I0KR5f7x3YTp6kI9BqGCzXdv6MeUKAH3+hVUpJnVTIlF3u6JFyBzEMGTQHxaf8S 2xJg==
- In-reply-to: <CAHYJk3SkuwnHAWhe_NFJpGT-VpBhO1CSOTiP-_mYzXnWb=bPnA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <OFB4919E60.BB31A680-ONC1257B2E.0040C2F4-C1257B2E.00428ABB@de.ibm.com> <CAHYJk3SkuwnHAWhe_NFJpGT-VpBhO1CSOTiP-_mYzXnWb=bPnA@mail.gmail.com>
On 14 March 2013 13:06, Dominik Vogt <VOGT@xxxxxxxxxx> wrote:
>
> 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>.
alt-/ (_history-complete-older)
> 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.
_insert_next_word () {
zle .insert-last-word 1 -1
}
zle -N insert-next-word _insert_next_word
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author