Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion doc/builtin.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*builtin.txt* For Vim バージョン 9.2. Last change: 2026 Sep 13
*builtin.txt* For Vim バージョン 9.2. Last change: 2026 Sep 14


VIM リファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -5195,6 +5195,29 @@ getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()*
対して "col" 値 0 が使用される。
(デフォルト: |FALSE|)

bounds |TRUE| の場合、領域の外側の境界のみを
単一のペアとして返す: >
[[{start_pos}, {end_pos}]]
< {start_pos} は領域の最初の行における開
始位置、{end_pos} は最後の行における終
了位置である。その間の行は処理の対象と
ならないため、大きな領域を扱う場合には
るかに高速に動作する。
(デフォルト: |FALSE|)

同じ {opts} を指定して "bounds" を使用することは、完全な結果の
外側の位置を取得することと同等である: >
let full = getregionpos(pos1, pos2, opts)
let bounds = [[full[0][0], full[-1][1]]]
< 例えば {pos1} と {pos2} が異なるバッファにある場合など、完全な
結果が空であるとき、結果も同様に空となる。
Note これら 2 つの位置は異なる行に属するため、領域の形状そのも
のではなく、その領域の対角線を表すことになる点に注意。ブロック
単位の領域の場合、これらはブロックの隅ではなく、最初の行の開始
位置と最後の行の終了位置となる。同様に、最初の行が空で "eol"
が |FALSE| の場合、{start_pos} の "col" は 0 になるが、
{end_pos} は必ずしもそうとは限らない。

|method| としても使用できる: >
getpos('.')->getregionpos(getpos("'a"))
<
Expand Down
27 changes: 26 additions & 1 deletion en/builtin.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.2. Last change: 2026 Sep 13
*builtin.txt* For Vim version 9.2. Last change: 2026 Sep 14


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -5260,6 +5260,31 @@ getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()*
value of 0 is used for both positions.
(default: |FALSE|)

bounds If |TRUE|, return only the outer
bounds of the region as a single
pair: >
[[{start_pos}, {end_pos}]]
< {start_pos} is the start position on
the first line of the region and
{end_pos} the end position on its
last line. The lines in between are
not visited, which is much faster for
a large region.
(default: |FALSE|)

Using "bounds" with the same {opts} is equivalent to taking
the outer positions of the full result: >
let full = getregionpos(pos1, pos2, opts)
let bounds = [[full[0][0], full[-1][1]]]
< When the full result is empty, e.g. because {pos1} and {pos2}
are in different buffers, the result is empty as well.
Note that the two positions then come from different lines, so
they describe a diagonal of the region and not its shape. For
a blockwise region they are the start of the first line and
the end of the last line, not the corners of the block.
Likewise, when the first line is empty and "eol" is |FALSE|,
{start_pos} has a "col" of 0 while {end_pos} may not.

Can also be used as a |method|: >
getpos('.')->getregionpos(getpos("'a"))
<
Expand Down
Loading