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

Re: Documentation of $MARK and "vi-mode operators"



On 27 Aug, Bart Schaefer wrote:
> A quick question given that I am not usually a "bindkey -v" user --
> the doc says:
>
> MARK (integer)
>      Like CURSOR, but for the mark.  With vi-mode operators that wait
>      for a movement command to select a region of text, setting MARK
>      allows the selection to extend in both directions from the initial
>      cursor position.
>
> Are there any "vi-mode operators that wait for a movement command to
> select a region" other than visual-mode and visual-line-mode ?

The vi-mode operators that wait for a movement command are things like
vi-change, vi-delete and vi-yank.

For examples of widgets that set MARK to select a region of text, search
for "Text Objects" in the documentation - that's also the term used in
vim documentation. Examples include select-a-shell-word and
select-in-word. So, e.g. diw will delete the current word that the
cursor is on regardless of whether the cursor is at the beginning,
middle or end of the word. But you can also use iw from visual mode to
select a word. Zsh includes some text objects written in shell code too.

> Both of which automatically set the mark upon entry, as far as I can
> tell, unless it is already set?

Yes, for the common case they need to initialise MARK.

Oliver




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