From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26318 invoked by alias); 3 Jun 2015 10:05:26 -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: 20247 Received: (qmail 6463 invoked from network); 3 Jun 2015 10:05:22 -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.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.0 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Yuri D'Elia Subject: Re: bracketed paste mode in xterm and urxvt Date: Wed, 03 Jun 2015 12:04:45 +0200 Message-ID: References: <55677AF5.50709@thequod.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: adsl-ull-33-103.49-151.net24.it User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 In-Reply-To: On 06/03/2015 10:35 AM, Jesper Nygårds 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.