Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bracketed paste
- X-seq: zsh-workers 29899
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- Subject: Re: bracketed paste
- Date: Mon, 7 Nov 2011 23:42:46 +0100
- Cc: Zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3baCQeMtgrrD7z1VyONUFDWcWVeTuAf9UrWLM+nLOGo=; b=sbwDwPWgie3XDDTLib60jl57x+clM5Wt2JlQOCPN6VfhiGaBu4VCEAVa7LU1l17Brd sqWfguUDl0CgNdP8utoecf0KAHta62PbX0pbKgseTWuCf+gUSIjH5UMLVY1qf7/cZY0+ PTTPj5fYKA/n34zWmg53rkHs7gxmYdBbDd0Qc=
- In-reply-to: <588.1320705064@thecus.kiddle.eu>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <588.1320705064@thecus.kiddle.eu>
On 7 November 2011 23:31, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> Has anyone tried enabling the bracketed paste feature of xterm?
I have this for urxvt (now, this is a bit spread out in my config, so
I might miss some bits here, hope not).
bindkey -N paste
bindkey -R -M paste "^@"-"\M-^?" paste-insert
bindkey '^[[200~' _start_paste
bindkey -M paste '^[[201~' _end_paste
bindkey -M paste -s '^M' '^J'
function _zle_line_init() {
# Tell urxvt to send escape codes around a paste
[[ $TERM == rxvt-unicode || $TERM = xterm ]] && printf '\e[?2004h'
}
function _zle_line_finish() {
# Tell it to stop
[[ $TERM == rxvt-unicode || $TERM = xterm ]] && printf '\e[?2004l'
}
function _start_paste() {
bindkey -A paste main
}
function _end_paste() {
bindkey -e
if [[ $_SPACE_AFTER_PASTE_QUOTE = 1 ]]; then
LBUFFER+=${(q)_paste_content}' '
else
LBUFFER+=$_paste_content
fi
unset _paste_content
}
function _spaceafterpastequote() {
if [[ $_SPACE_AFTER_PASTE_QUOTE = 1 ]]; then
_SPACE_AFTER_PASTE_QUOTE=0
zle -M "Not inserting a space after pastes, not quoting"
else
_SPACE_AFTER_PASTE_QUOTE=1
zle -M "Inserting a space after pastes and quoting"
fi
}
function _paste_insert() {
_paste_content+=$KEYS
}
zle -N zle-line-init _zle_line_init
zle -N zle-line-finish _zle_line_finish
zle -N _start_paste
zle -N _end_paste
zle -N paste-insert _paste_insert
zle -N _spaceafterpastequote
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author