From 2a3bf651691a74ece626ae093c53a7e18ec2a35b Mon Sep 17 00:00:00 2001 From: Fabian Ising Date: Mon, 14 Oct 2024 15:50:37 +0200 Subject: [PATCH] [ZSH] Fix slow paste --- zsh/.zshrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zsh/.zshrc b/zsh/.zshrc index 27a91f9..48886c2 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -67,6 +67,20 @@ function load_p10k() { fi } load_p10k +# +# This speeds up pasting w/ 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 # I wonder if you'd need `.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 + export LANG="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8" export TIME_STYLE="long-iso"