=== modified file 'zsh-functions/site_zshrc_70_keybindings' --- zsh-functions/site_zshrc_70_keybindings 2016-08-03 22:07:41 +0000 +++ zsh-functions/site_zshrc_70_keybindings 2013-06-04 18:44:28 +0000 @@ -102,43 +102,6 @@ } zle -N transpose-words-match-right -# VIM-style i_CTRL-V_digit input for character codes -bindkey -M viins '^V0' viins-ctrl-v-digit -bindkey -M viins '^V1' viins-ctrl-v-digit -bindkey -M viins '^V2' viins-ctrl-v-digit -bindkey -M viins '^Vo' viins-ctrl-v-octal -bindkey -M viins '^VO' viins-ctrl-v-octal -bindkey -M viins '^Vx' viins-ctrl-v-hex -bindkey -M viins '^VX' viins-ctrl-v-hex -bindkey -M viins '^Vu' viins-ctrl-v-hex -bindkey -M viins '^VU' viins-ctrl-v-hex - -zle -N viins-ctrl-v-digit _viins_escape_decimal -zle -N viins-ctrl-v-octal _viins_escape_octal -zle -N viins-ctrl-v-hex _viins_escape_hex - -function _viins_escape_decimal() { - IFS= read -srk 2 - REPLY='10#'$KEYS[2]${REPLY//[^0-9]/} - LBUFFER+=${(#)REPLY} -} - -function _viins_escape_octal() { - IFS= read -srk 3 - REPLY='8#'${REPLY//[^0-7]/} - LBUFFER+=${(#)REPLY} -} - -function _viins_escape_hex() { - case $KEYS[2] in - (u) IFS= read -srk 4;; - (U) IFS= read -srk 8;; - (*) IFS= read -srk 2;; - esac - REPLY='16#'${REPLY//[^0-9a-fA-F]/} - LBUFFER+=${(#)REPLY} -} - # arrow movements bindboth "^[OC" vi-forward-word bindboth "^[OD" vi-backward-word @@ -201,5 +164,3 @@ zle -N mark-and-move-next bindkey -M filterselect '^X' mark-and-move-next fi - -# vim: ft=zsh noet === modified file 'zsh-functions/site_zshrc_75_bracketed_paste' --- zsh-functions/site_zshrc_75_bracketed_paste 2016-08-03 22:07:41 +0000 +++ zsh-functions/site_zshrc_75_bracketed_paste 2016-03-10 14:49:29 +0000 @@ -2,14 +2,6 @@ # # Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed # paste mode as documented: http://www.xfree86.org/current/ctlseqs.html -# -# Extended by Jan Pobrislo : -# The bracketed paste mode is extended to support VIM-like -# CTRL-V input method that can be used to escape the pasted -# content. -# -# Script for rxvt-unicode to escape control characters like that is here: -# http://wpr.cz/ccx/paste/2016-08-03/0/ # create a new keymap to use while pasting bindkey -N paste @@ -22,22 +14,10 @@ bindkey -M paste '^[[201~' _end_paste # insert newlines rather than carriage returns when pasting newlines bindkey -M paste -s '^M' '^J' -bindkey -M paste '^V0' paste-ctrl-v-digit -bindkey -M paste '^V1' paste-ctrl-v-digit -bindkey -M paste '^V2' paste-ctrl-v-digit -bindkey -M paste '^Vo' paste-ctrl-v-octal -bindkey -M paste '^VO' paste-ctrl-v-octal -bindkey -M paste '^Vx' paste-ctrl-v-hex -bindkey -M paste '^VX' paste-ctrl-v-hex -bindkey -M paste '^Vu' paste-ctrl-v-hex -bindkey -M paste '^VU' paste-ctrl-v-hex zle -N _start_paste zle -N _end_paste zle -N paste-insert _paste_insert -zle -N paste-ctrl-v-digit _paste_escape_decimal -zle -N paste-ctrl-v-octal _paste_escape_octal -zle -N paste-ctrl-v-hex _paste_escape_hex # switch the active keymap to paste mode function _start_paste() { @@ -51,7 +31,7 @@ #use bindkey -v here with vi mode probably. maybe you want to track #if you were in ins or cmd mode and restore the right one. bindkey -v - LBUFFER+=${_paste_content} + LBUFFER+=${(qqq)_paste_content} unset _paste_content } @@ -59,39 +39,17 @@ _paste_content+=$KEYS } -function _paste_escape_decimal() { - IFS= read -srk 2 - REPLY='10#'$KEYS[2]${REPLY//[^0-9]/} - _paste_content+=${(#)REPLY} -} - -function _paste_escape_octal() { - IFS= read -srk 3 - REPLY='8#'${REPLY//[^0-7]/} - _paste_content+=${(#)REPLY} -} - -function _paste_escape_hex() { - case $KEYS[2] in - (u) IFS= read -srk 4;; - (U) IFS= read -srk 8;; - (*) IFS= read -srk 2;; - esac - REPLY='16#'${REPLY//[^0-9a-fA-F]/} - _paste_content+=${(#)REPLY} -} - function _zle_line_init_paste() { # Tell terminal to send escape codes around pastes. - case ${TERM#-256color} in (rxvt-unicode|xterm) printf '\e[?2004h';; esac + [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004h' } zle_init_add _zle_line_init_paste function _zle_line_finish_paste() { # Tell it to stop when we leave zle, so pasting in other programs # doesn't get the ^[[200~ codes around the pasted text. - case ${TERM#-256color} in (rxvt-unicode|xterm) printf '\e[?2004l';; esac + [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004l' } zle_finish_add _zle_line_finish_paste -# vim: ft=zsh et sw=2 +# vim: ft=zsh