Skip to content

Commit 93eb081

Browse files
numEricLchrisbra
authored andcommitted
runtime(doc): Clarify visual mark behavior in getpos(), setpos()
Add documentation notes explaining that visual marks '< and '> have different behaviors in getpos() and setpos(). Also fix a small typo. closes: #19070 Signed-off-by: Larson, Eric <numeric.larson@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 57352b2 commit 93eb081

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

runtime/doc/builtin.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*builtin.txt* For Vim version 9.1. Last change: 2025 Dec 21
1+
*builtin.txt* For Vim version 9.1. Last change: 2026 Jan 03
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4879,6 +4879,11 @@ getpos({expr}) *getpos()*
48794879
within the line. To get the character position in the line,
48804880
use |getcharpos()|.
48814881

4882+
The visual marks |'<| and |'>| refer to the beginning and end
4883+
of the visual selection relative to the buffer. Note that
4884+
this differs from |setpos()|, where they are relative to the
4885+
cursor position.
4886+
48824887
Note that for '< and '> Visual mode matters: when it is "V"
48834888
(visual line mode) the column of '< is zero and the column of
48844889
'> is a large number equal to |v:maxcol|.
@@ -10152,9 +10157,14 @@ setpos({expr}, {list}) *setpos()*
1015210157
preferred column is not set. When it is present and setting a
1015310158
mark position it is not used.
1015410159

10155-
Note that for '< and '> changing the line number may result in
10156-
the marks to be effectively be swapped, so that '< is always
10157-
before '>.
10160+
Note that for |'<| and |'>| changing the line number may
10161+
result in the marks to be effectively swapped, so that |'<| is
10162+
always before |'>|.
10163+
10164+
The visual marks |'<| and |'>| refer to the beginning and end
10165+
of the visual selection relative to the cursor position.
10166+
Note that this differs from |getpos()|, where they are
10167+
relative to the buffer.
1015810168

1015910169
Returns 0 when the position could be set, -1 otherwise.
1016010170
An error message is given if {expr} is invalid.

0 commit comments

Comments
 (0)