Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Select Whole, When There are Multiple Lines
Ahmad Ismail wrote on Sat, 25 Sep 2021 11:29 +00:00:
> I mean when there are multiple lines on the prompt, the keybinding
> only works for the line where the cursor is. How can I select all
> lines using ctrl-A
This works:
f() { MARK=0; CURSOR=$#BUFFER; REGION_ACTIVE=1; }
zle -N f
bindkey '^T' f
echo foo^V^Jecho bar^T # In this line, ^X means to press Ctrl+X
It doesn't work in some other cases. It works when $BUFFER is
multiline and $PREBUFFER is empty, but it doesn't work when $BUFFER is
single-line and the previous content is in $PREBUFFER. You might be
able to simulate that with 'P' ranges in region_highlight and
overriding widgets that operate on the region, but it might be easier
to just use edit-command-line.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author