From 3920f914d0e3bda86adea715e801855a799c420c Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Mon, 15 Apr 2019 15:05:37 +0530 Subject: [PATCH] Zsh: Make Paste Fast Again Thanks @hthuwal https://github.com/zsh-users/zsh-autosuggestions/issues/238 --- zsh/hacks.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/zsh/hacks.zsh b/zsh/hacks.zsh index 992a87c..83f4491 100644 --- a/zsh/hacks.zsh +++ b/zsh/hacks.zsh @@ -9,3 +9,20 @@ zmodload -a colors zmodload -a autocomplete zmodload -a complist zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} + +# ---------------------- MAKE PAINFULLY SLOW PASTE FAST ---------------------- # + +# https://github.com/zsh-users/zsh-autosuggestions/issues/238#issuecomment-389324292 + +# This speeds up pasting with autosuggest +# https://github.com/zsh-users/zsh-autosuggestions/issues/238 +pasteinit() { + OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]} + zle -N self-insert url-quote-magic +} + +pastefinish() { + zle -N self-insert $OLD_SELF_INSERT +} +zstyle :bracketed-paste-magic paste-init pasteinit +zstyle :bracketed-paste-magic paste-finish pastefinish