Zsh Mailing List Archive
Messages sorted by:
- X-seq: zsh-workers 29898
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: bracketed paste
- Date: Mon, 07 Nov 2011 23:31:04 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1320705065; bh=q9bR/c3WvfU8P/rCQm9p5HvrXSEP0qjA8SBRvaewGrI=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:From:To:Subject:Date:Message-ID; b=Z/Iz58H44zTIdoI1G/qn4OdqrhOhx7n7hcpm3tn/l7CUujdmymiA0uYOdJ6Ew88qyLGNl53hn2H3tK31cO5/IjNzbwhdbTqJkaxBWga3DLg+nTtNPVkkEFNUdn+v9ZvDWYgAbW94G2VhIvmFhdS12ETYbrWAPQLXYiG6SGkZB2k=
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Has anyone tried enabling the bracketed paste feature of xterm?
Basically, when you paste text it is preceded by \e[200~ and terminated
with \e[201~. This has the potential to solve some irritations with
paste: undo can undo all the pasted text in one go, pasted tab
characters won't invoke completion and in vi command mode, pasted text
mightn't be treated as vi commands.
To handle this, what I've tried so far is putting \e[?2004h at the end
of PS1 and PS2 to enable it and \e[?2004l in POSTEDIT so it doesn't
remain enabled for other software. I then put together the following
zle widget which is, of course, bound to \e[200~.
local REPLY paste
local end=$'\e[201~' idx=1
while (( idx <= $#end )) && read -k 1; do
[[ $REPLY = $end[idx++] ]] || (( idx = 1 + (#REPLY == #end) ))
if (( NUMERIC )); then
The main problem I've found is that you can't paste into the mini-
buffer. Is there any way around that?
Does it make sense to include this function in Functions/Zle? It would
still require people to enable bracketed paste in their xterm. Any other
thoughts on what you might do with the pasted text besides pasting it.
$LASTWIDGET might be useful here. The function above quotes the text if
you supply a numeric argument. This can be useful when pasting, e.g.
URLs. In the past, I've used a separate widget that tries to get the
buffer with xclip, xselection or xprop.
Messages sorted by: