From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9655 invoked by alias); 3 Jun 2015 10:15:02 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20248 Received: (qmail 18518 invoked from network); 3 Jun 2015 10:15:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Z//z9kA77CJ5Le+x7HHgV/T3mm3NqwhspHMZC5XCXHU=; b=YLljaDfI8qozubMkeFbJBS6F61+NhHMOgtbwDhgl9Dk12yu4DbaKGlT3y4WWIDCnZk leD3EVOmplaD7wfpsykDpdVUOoEQxRLbMjSBVUG/lyZQ1KaOKjeV89aCGA8eWUuhPbVd +gyNLzo91oONnvEXIqks9T3PiryX7UURZPn4iydl5TgqL/CoQwXTiJ9iWSmVB0Wxo70h IPVYRmX00vqHE2gZBbYPzHQXtHu4re0G5mUEH3+85O8RArncc6QIQ5CTAceqAxG0ArAW lm607zusIf3YiemAaMVLm4arZ7pJAzKpk/aYm5EEj3iC3nDYZVD9tcKgI3L+s5IYCTZQ jXFg== MIME-Version: 1.0 X-Received: by 10.112.171.68 with SMTP id as4mr31190803lbc.64.1433326496855; Wed, 03 Jun 2015 03:14:56 -0700 (PDT) In-Reply-To: References: <55677AF5.50709@thequod.de> Date: Wed, 3 Jun 2015 12:14:56 +0200 Message-ID: Subject: Re: bracketed paste mode in xterm and urxvt From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= To: Zsh Users Content-Type: multipart/alternative; boundary=001a11c38d1ab13bfb05179a54ab --001a11c38d1ab13bfb05179a54ab Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable OK, I see. I already use url-quote-magic for pasting urls, but I can see the advantage of also being able to edit the paste before it's really inserted. On Wed, Jun 3, 2015 at 12:04 PM, Yuri D'Elia wrote: > On 06/03/2015 10:35 AM, Jesper Nyg=C3=A5rds wrote: > > I have a hard time figuring out how this is useful. Could you guys post > > some examples of what you are using this function for? > > Bracketed paste is of course useful for copy/paste in the terminal. > > When pasting in a terminal, normally the shell receives the raw input, > including newlines, quotes and the like. There's no difference between > typing and pasting. For example, often you want to select a code snippet > from a web page, and the page might include extra markup that breaks the > command and/or runs it directly even when you're careful. > > Besides being dangerous, it's also annoying that you need to quote the > pasted text manually. For example > > wget > > will often fail if the url contains ?. You need to edit the command and > quote it. Annoying. > > Bracketed paste is implemented by the terminal+shell: the terminal sends > control sequences during paste that allow the shell to know that > something is being paste as opposed to being typed. The shell can then > act accordingly. > > In the 'safe-paste' oh-my-zsh plugin, the pasted text is not directly > executed: the newlines are inserted as a multi-line command instead, > which allow you to see the command before executing it instead. > > In the posted examples, you can actually chose if the pasted text should > be literal or quoted. With quoted paste, you can pass urls and similar > blocks of text as command arguments without having to fudge it. > > --001a11c38d1ab13bfb05179a54ab--