Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: (backward-)kill-argument
- X-seq: zsh-workers 16837
- From: Sven Wischnowsky <wischnow@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: (backward-)kill-argument
- Date: Fri, 15 Mar 2002 09:55:11 +0100
- In-reply-to: <m2zo1cxvvl.fsf@xxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <m2zo1cxvvl.fsf@xxxxxxxxxxxxxxxxxxxxx>
Michal =?iso-8859-2?q?Maru=B9ka?= wrote:
> i want to:
> * kill filenames w/ spaces: e.g. this\ is\ file.txt
Write yourself a little widget. As a starting point:
zle -N kill-with-spaces
kill-with-spaces() {
local words
words="${(z)BUFFER}"
BUFFER="${BUFFER%${words[-1]}[ ]#}"
}
bindkey <key> kill-with-spaces
(There's a space and a TAB inside that [ ].)
> * maybe even the bracketed part:
> find { -name '*.h' }
>
> Is it possible in Zsh?
Using the above you could check if $words[-1] is one of the closing
braces and if it is, search back in the array for the matching opening
brace. When found, you can delete the end of $BUFFER up to that
matching brace by using a pattern of the form:
${words[-n]}[ ]##...[ ]##${words[-1]}[ ]#
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author