zsh-users
 help / color / mirror / code / Atom feed
* Documentation of $MARK and "vi-mode operators"
@ 2023-08-27 21:08 Bart Schaefer
  2023-09-02  1:22 ` Oliver Kiddle
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2023-08-27 21:08 UTC (permalink / raw)
  To: Zsh Users

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 ?

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Documentation of $MARK and "vi-mode operators"
  2023-08-27 21:08 Documentation of $MARK and "vi-mode operators" Bart Schaefer
@ 2023-09-02  1:22 ` Oliver Kiddle
  2023-09-02 22:21   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2023-09-02  1:22 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Documentation of $MARK and "vi-mode operators"
  2023-09-02  1:22 ` Oliver Kiddle
@ 2023-09-02 22:21   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2023-09-02 22:21 UTC (permalink / raw)
  To: Zsh Users

On Fri, Sep 1, 2023 at 6:22 PM Oliver Kiddle <opk@zsh.org> wrote:
>
> The vi-mode operators that wait for a movement command are things like
> vi-change, vi-delete and vi-yank.

OK, that makes sense.

> For examples of widgets that set MARK to select a region of text, search
> for "Text Objects" in the documentation

Right; I was hunting for a built-in widget that sets MARK as opposed
to setting one of the labeled marks.  But I guess MARK is set only as
a side-effect of motions in default vi mode.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-02 22:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-27 21:08 Documentation of $MARK and "vi-mode operators" Bart Schaefer
2023-09-02  1:22 ` Oliver Kiddle
2023-09-02 22:21   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).