zsh-users
 help / color / mirror / code / Atom feed
From: "Jesper Nygårds" <jesper.nygards@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: bracketed paste mode in xterm and urxvt
Date: Wed, 3 Jun 2015 12:14:56 +0200	[thread overview]
Message-ID: <CABZhJg8bFYVbf3wXHmu-RgYh62xLFjkDiH166KVRJLC1X9j78g@mail.gmail.com> (raw)
In-Reply-To: <mkmjfu$3h0$1@ger.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]

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 <wavexx@thregr.org> wrote:

> 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 <paste url>
>
> 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.
>
>

  reply	other threads:[~2015-06-03 10:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-22 19:16 Mikael Magnusson
2015-05-28 11:42 ` Jérémie Roquet
2015-05-28 19:16   ` Yuri D'Elia
2015-05-28 20:30   ` Daniel Hahler
2015-05-28 22:30     ` Bart Schaefer
2015-05-29 10:00     ` Yuri D'Elia
2015-06-03  8:35       ` Jesper Nygårds
2015-06-03  8:48         ` toki clover
2015-06-03 10:04         ` Yuri D'Elia
2015-06-03 10:14           ` Jesper Nygårds [this message]
2015-06-03 12:06           ` Mikael Magnusson
2015-06-03 14:01             ` Yuri D'Elia
2015-06-06  8:51               ` toki clover

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABZhJg8bFYVbf3wXHmu-RgYh62xLFjkDiH166KVRJLC1X9j78g@mail.gmail.com \
    --to=jesper.nygards@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).