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

Re: PATCH: highlight pasted text



Mikael Magnusson wrote on Thu, Jul 23, 2015 at 07:00:40 +0200:
> Is there any way to use any of this (the highlighting) if you wrap the
> widget to manipulate the text first?

Here's an attempt to summarize the solutions proposed later in the thread:

paste-and-munge() {
  local unmunged munged
  zle .bracketed-paste unmunged
  munged=":::${unmunged}:::"
  LBUFFER+=$munged
  (( MARK = $#LBUFFER - $#munged ))
  zle kill-region
  zle yank
  zle -R
  zle read-command && zle -U - $KEYS
}
bindkey -s $zle_bracketed_paste[2] paste-and-munge
zle -N bracketed-paste paste-and-munge
zle_highlight=(paste:standout)

I haven't incorporated split-undo.



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