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

Re: bracketed paste mode in xterm and urxvt



On 05/28/2015 01:42 PM, Jérémie Roquet wrote:
> PS: below is the full quote of the original mail, which could be
> useful for people that weren't on this list four years ago. Or for
> people like me who didn't give it the attention it deserves.
> PS2: I've added screen-256color to my list of supported terminals,
> though technically I'm not sure it supports bracketed paste (and I'm
> running tmux anyway).

Awesomeness. But I didn't like the quoting toggle.
What about these few changes:

function _start_quoted_paste() {
  _paste_quoted=1
  bindkey -A paste main
}

function _start_paste() {
  _paste_quoted=0
  bindkey -A paste main
}

function _end_paste() {
  bindkey -e
  [[ $_paste_quoted == 1 ]] && LBUFFER+=${(q)_paste_content} ||
LBUFFER+=$_paste_content
  unset _paste_content _paste_quoted
}

and now:

bindkey '^x^[[200~' _start_quoted_paste
bindkey '^[[200~' _start_paste

so regular paste is unquoted, but ^x before the paste and it will be
quoted for you. ^x is already a prefix key for me.




Messages sorted by: Reverse Date, Date, Thread, Author