zsh trim newline in paste and history
bracketed-paste() {
zle .$WIDGET && LBUFFER=${LBUFFER%$'\n'}
}
zle -N bracketed-paste
zshaddhistory() {
setopt LOCAL_OPTIONS
setopt EXTENDED_GLOB
print -sr -- "${1%%$'\n'##}"
fc -p "$HISTFILE"
return 1
}