Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: counterintuitive behavior of zle_bracketed_paste



Peter Backes wrote on Sun, 11 Jun 2017 12:37 +0200:
> While backeted paste mode is certainly a good thing, this behavior is 
> very counterintuitive.  If the last pasted character is a return, the 
> command should instead be executed instantly.  Users who do not want to 
> execute instantly can simply not paste a return on the last line, as 
> before.  Please change zsh accordingly.

You can change the behaviour locally by overriding the bracketed-paste
widget in your zshrc:

[[[
bracketed-paste() {
  local PASTED # as in bracketed-paste-magic
  zle .bracketed-paste PASTED
  # mimic built-in widget's functionality
  (( NUMERIC == 0 )) || PASTED=${(q-)PASTED}
  zle -f 'yank'; YANK_START=$#LBUFFER; (( YANK_END = $#LBUFFER + $#PASTED ))
  LBUFFER+=$PASTED
  if [[ $PASTED[-1] == $'\n' ]]; then
    zle accept-line
  fi
}
zle -N bracketed-paste
]]]

I'll let others comment on your second question of changing the defaults.

Cheers,

Daniel

> Please mail me directly if you reply as I am not subscribed to the list.



Messages sorted by: Reverse Date, Date, Thread, Author