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

Re: Shift-Insert overwrites ZLE CUTBUFFER



On Oct 26, 12:28am, lolilolicon wrote:
} Subject: Re: Shift-Insert overwrites ZLE CUTBUFFER
}
} On Wed, Oct 26, 2016 at 12:12 AM, Bart Schaefer
} <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > There's currently no easy way to change the cutbuffer behavior without
} > disabling the rest of the bracketed-paste behavior.
} 
} That's a shame.
} Is it technically difficult to do? Would there be an issue if zsh just
} popped the killring automatically?

What I mean is that it's not easy to do from shell code.  In the source
code obviously the implementation is deliberately pushing the kill ring,
so it wouldn't be technically difficult to *not* do so, but that would
mean reversing an earlier design decision.

Something like this sort of works:

  my-bracketed-paste {
    zle .bracketed-paste "$@" && {
      local pasted=$CUTBUFFER
      # Swap the top two killed items to fake out ^Y
      CUTBUFFER=$killring[1]
      killring[1]=$pasted
    }
  }
  zle -N bracketed-paste my-bracketed-paste

But I wouldn't have called that an "easy way".

Various other approaches involving saving/restoring CUTBUFFER and killring
are also possible.



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