Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: (backward-)kill-argument



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