Skip to content

Instantly share code, notes, and snippets.

@tleepa
Last active August 24, 2022 14:40
Show Gist options
  • Save tleepa/a153d2a7fe80db55298057d1c8264ef4 to your computer and use it in GitHub Desktop.
Save tleepa/a153d2a7fe80db55298057d1c8264ef4 to your computer and use it in GitHub Desktop.
ZSH paste fixes
# 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
# https://github.com/zsh-users/zsh-autosuggestions/issues/351
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment