Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: prepopulate BUFFER
- X-seq: zsh-users 27709
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Subject: Re: prepopulate BUFFER
- Date: Fri, 29 Apr 2022 15:25:36 +0100 (BST)
- Archived-at: <https://zsh.org/users/27709>
- Importance: Medium
- In-reply-to: <CAP+y1xBns9MVzdpFajTfc2QzeDUWAiniNgpFxi2_OG=mF-WJ_w@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAP+y1xDy9Efe1X5+TKgSU7G_NhuV9U_ttM9xdTYfBryk++FYvw@mail.gmail.com> <747863791.139295.1651238910118@mail2.virginmedia.com> <CAP+y1xA95=Ohy_kqznbo5T5QRiQGbLrJiV8A-e-K6_V93wUJfQ@mail.gmail.com> <CAP+y1xBns9MVzdpFajTfc2QzeDUWAiniNgpFxi2_OG=mF-WJ_w@mail.gmail.com>
> On 29 April 2022 at 15:18 Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
> actually I have another question, is there a similar way of setting the
> initial cursor position like I would do setting the CURSOR var in zle
> widgets?
As long as something else hasn't already taken over zle-line-init, you
can do something like
zle-line-init() {
if (( set_cursor )); then
(( CURSOR = set_cursor ))
set_cursor=0
fi
}
zle -N zle-line-init
then you can use it like
print -z "foo bar"; typeset -gi set_cursor=4
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author