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

Re: prepopulate BUFFER



Hi, thanks, I already use that, I even have a widget that rebinds enter so I can switch it temporarily to accept-and-hold.
This use case is a bit different, since I return always to the original (incomplete) version of the command line, and I have only to complete it instead of deleting what I don't need anymore and fill the blanks

Pier Paolo Grassi


Il giorno ven 29 apr 2022 alle ore 17:25 Mikael Magnusson <mikachu@xxxxxxxxx> ha scritto:
On 4/29/22, Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
> thanks, I ended doing it like this:
>
> zle-line-init(){
>     [[ -n $__precmd_buffer ]] && {
>         BUFFER=$__precmd_buffer
>         CURSOR=$__precmd_cursor
>     }
> }
>
> and storing the current line and cursor position with:
>
> set_precmd_buffer() {
>     __precmd_buffer=$BUFFER
>     __precmd_cursor=$CURSOR
> }
> zle -N set_precmd_buffer set_precmd_buffer
> bindkey "^X^[e" set_precmd_buffer
>
> best regards!

Perhaps you would like to know about the accept-and-hold widget (bound
to alt-a by default)?

--
Mikael Magnusson


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