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

Re: How to avoid infinite recursion in ZLE widgets



Hello,

On Wed, Sep 23, 2020 at 10:34:50AM +0200, Peter Slížik wrote:
> I'd like to replicate the functionality found in some text editors - namely
> that if you press a single or double quote, the editor inserts two of them
> and places the cursor inside the pair.

What about simply modifying the buffer like this:

function insert-single-quotes() {
  LBUFFER+="'"
  RBUFFER="'$RBUFFER"
}

> zle -N insert-single-quotes
> bindkey "'" insert-single-quotes    # that's "_'_"

-- 
zsugabubus




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