Skip to content

Commit 4dde293

Browse files
authored
Merge pull request #2325 from h-east/update-cmdline
Update cmdline.{txt,jax}
2 parents f082a95 + daf865e commit 4dde293

File tree

2 files changed

+148
-57
lines changed

2 files changed

+148
-57
lines changed

doc/cmdline.jax

Lines changed: 68 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*cmdline.txt* For Vim バージョン 9.1. Last change: 2025 Sep 10
1+
*cmdline.txt* For Vim バージョン 9.1. Last change: 2025 Sep 15
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -713,15 +713,16 @@ Exコマンドには、その前に行単位の範囲を指定できるものが
713713

714714
基本事項はユーザーマニュアルの |10.3| 章で説明されている。
715715

716-
|Vim9| script では継続行の曖昧さを避けるため、範囲にはコロンが接頭辞として必要
717-
となる。例として、"+" は範囲として使えるが式の継続でもある: >
716+
|Vim9| script では、継続行の曖昧さを避けるため、範囲にはコロンが接頭辞として必
717+
要となる。例として、"+" は範囲として使えるが式の継続でもある: >
718718
var result = start
719719
+ print
720-
"+" が範囲の場合はコロンが接頭辞として必要になる: >
721-
var result = start
720+
<ここにあるように "+" が範囲を表す場合、Vim9 script ではコロンを前に付ける必要
721+
がある (そうしないとエラー |E1050| が発生する): >
722+
vim9script
722723
:+ print
723724
<
724-
*:,* *:;*
725+
*:,* *:;*
725726
区切りに ';' を使うと、次の行指定子を解釈する前にカーソル位置がその行に移動
726727
する。',' ではこうならない。例: >
727728
4,/この行/
@@ -730,32 +731,71 @@ Exコマンドには、その前に行単位の範囲を指定できるものが
730731
< 5行目から、5行目より後の、"あの行" がマッチする行まで。
731732

732733
ほとんどのコマンドでは、範囲の既定値はカーソルのある行である。しかしコマンド
733-
":write", ":global" での既定値はファイル全体 (1,$) である。
734-
735-
コマンドに必要以上の行指定子が指定されたときは、先頭の方に指定されたものから順
736-
に除外される。
737-
734+
":write", ":global" での既定値はバッファ全体 (1,$) である。
735+
736+
コマンドに必要な数よりも多くの行指定子が指定された場合、コンマで区切られている
737+
ときは、左端の行指定子は無視される。例えば、次の例の -2,+ は次のようになる: >
738+
:-2,+,-2,. print
739+
<セミコロンで区切られている場合、左端の指定子から最後から2番目の指定子までが合
740+
計される。例えば、次の場合、-4 + 3 - 1 = -2 となる: >
741+
:-4;+3;-1;+2 print
742+
<
738743
行番号は以下の方法で指定できる: *:range* *{address}*
739744
{number} 絶対的な行番号 *E1247*
740-
. 現在の行 *:.*
741-
$ ファイルの最終行 *:$*
742-
% 1,$と同じ (ファイル全体) *:%*
743-
't マーク tの位置 (小文字) *:'*
744-
'T マーク Tの位置 (大文字); マーク位置が別ファイルにある
745-
ときには範囲指定には使えない
746-
/{pattern}[/] 次に {pattern} のマッチする行 (下向き) *:/*
747-
以下の |:range-pattern| も参照
748-
?{pattern}[?] 次に {pattern} のマッチする行 (上向き) *:?*
749-
以下の |:range-pattern| も参照
750-
\/ 次に直前の検索パターンのマッチする行 (下向き)
751-
\? 次に直前の検索パターンのマッチする行 (上向き)
752-
\& 次に直前の置換元パターンのマッチする行 (下向き)
745+
. 現在行 *:.*
746+
$ バッファの最終行 *:$*
747+
% 1,$ と同じ (バッファ全体) *:%*
748+
* '<,'> と同じ (最後に選択されたビジュアル領域の行。下
749+
|:star| を参照)
750+
'x マーク x の位置の行 *:'x*
751+
(ここで x は {a-z} の任意のマーク)
752+
'X マーク X の位置の桁 *:'X*
753+
(ここで X は {A-Z0-9} の任意のマークであるが、X が別の
754+
バッファにある場合は範囲指定で使用できない)
755+
'[ 最新の変更またはヤンクの最初の行 *:'[*
756+
'] 最新の変更またはヤンクの最後の行 *:']*
757+
'< 最後に選択されたビジュアル領域の最初の行 *:'<*
758+
'> 最後に選択されたビジュアル領域の最後の行 *:'>*
759+
'' 最後のジャンプの前の位置の行、または最後 *:''*
760+
に "m'"/"m`" コ>マンドが与えられた行 (た
761+
だし、カレントバッファにない場合は '' は
762+
1 になる)
763+
'" 最後にバッファを出た時のカーソル位置の行 *:'quote*
764+
'^ 最後に挿入モードを停止したときのカーソル *:'^*
765+
位置の行
766+
'. バッファが最後に変更されたときのカーソル *:'.*
767+
位置の行
768+
'( 現在の文の最初の文字の行 *:'(*
769+
') 現在の文の末尾の後の最初の文字の行 *:')*
770+
'{ カーソルのある段落の前の最初の空行 *:'{*
771+
'} カーソルのある段落の後の最初の空行 *:'}*
772+
/{pattern}[/] {pattern} がマッチする次の行 *:/*
773+
下記の |:range-pattern| も参照
774+
?{pattern}[?] {pattern} がマッチする前の行 *:?*
775+
下記の |:range-pattern| も参照
776+
\/ 最新の検索パターンにマッチする次の行
777+
\? 最新の検索パターンにマッチする前の行
778+
\& 最新の置換パターンがマッチする次の行
779+
780+
Note: 「次の行」と「前の行」には、現在の行に現れるマッチは含まれない。
753781

754782
*:range-offset*
755-
これらの後に '+' または '-' と数値を付けてもよい (複数も可)。この数は直前の行
756-
番号に加算または減算される。数が省略された場合は 1 が指定されたと見なされる。
757-
もし '+' や '-' の前に何も無い場合は現在行が使われる。
758-
*:range-closed-fold*
783+
各行指定子の後には、1つ以上の '+' または '-' と、オプションの数値を続けること
784+
ができる。その値は、前の行番号に加算または減算される。
785+
例えば、'x+2 はマーク x を含む行の 2 行後を表す。数値を省略した場合、'+' には
786+
+1、'-' には -1 がそれぞれ適用される。つまり、'x++ と 'x+2 は同義である。'+'
787+
または '-' の前に何も指定しない場合、[range] の最初の行番号として、現在行が相
788+
対的な開始点として使用される。つまり、-,. は「現在行の 1 つ前の行から現在行ま
789+
で」を意味する。[range] の 2 番目の行番号の値は、行番号をコンマで区切るかセミ
790+
コロンで区切るかによって異なる (|:,| および |:;| を参照)。
791+
例: カーソルが現在行の下の行にある場合、以下のコマンドはいずれもタグ行
792+
":range-offset" と行 "Each..." を出力する: >
793+
:-11;+1 print
794+
:-----------,-10 print
795+
:?Each line?-;+ print
796+
:'{+,'{+2 print
797+
:'{+1;')-1 print
798+
< *:range-closed-fold*
759799
コンマの後の行番号が閉じた折り畳みにある場合、折り畳みの最後の行に調整されるた
760800
め、折り畳み全体が含まれる。
761801

en/cmdline.txt

Lines changed: 80 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*cmdline.txt* For Vim version 9.1. Last change: 2025 Sep 10
1+
*cmdline.txt* For Vim version 9.1. Last change: 2025 Sep 15
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -745,16 +745,17 @@ Some Ex commands accept a line range in front of them. This is noted as
745745

746746
The basics are explained in section |10.3| of the user manual.
747747

748-
In |Vim9| script a range needs to be prefixed with a colon to avoid ambiguity
748+
In |Vim9| script, a range needs to be prefixed with a colon to avoid ambiguity
749749
with continuation lines. For example, "+" can be used for a range but is also
750750
a continuation of an expression: >
751751
var result = start
752752
+ print
753-
If the "+" is a range then it must be prefixed with a colon: >
754-
var result = start
753+
<If the "+" is a range, as it is here, in Vim9 script it must be prefixed
754+
with a colon (otherwise you will get error |E1050|): >
755+
vim9script
755756
:+ print
756757
<
757-
*:,* *:;*
758+
*:,* *:;*
758759
When separated with ';' the cursor position will be set to that line
759760
before interpreting the next line specifier. This doesn't happen for ','.
760761
Examples: >
@@ -764,36 +765,86 @@ Examples: >
764765
< from line 5 till match with "that line" after line 5.
765766

766767
The default line specifier for most commands is the cursor position, but the
767-
commands ":write" and ":global" have the whole file (1,$) as default.
768-
769-
If more line specifiers are given than required for the command, the first
770-
one(s) will be ignored.
771-
768+
commands ":write" and ":global" have the whole buffer (1,$) as default.
769+
770+
If more line specifiers are given than required for the command, when comma
771+
separated, the leftmost one(s) will be ignored, e.g., the -2,+ in this: >
772+
:-2,+,-2,. print
773+
<When semicolon separated, the leftmost specifier to the penultimate one are
774+
summed, e.g., -4 + 3 - 1 = -2, in this: >
775+
:-4;+3;-1;+2 print
776+
<
772777
Line numbers may be specified with: *:range* *{address}*
773778
{number} an absolute line number *E1247*
774-
. the current line *:.*
775-
$ the last line in the file *:$*
776-
% equal to 1,$ (the entire file) *:%*
777-
't position of mark t (lowercase) *:'*
778-
'T position of mark T (uppercase); when the mark is in
779-
another file it cannot be used in a range
780-
/{pattern}[/] the next line where {pattern} matches *:/*
779+
. the current line *:.*
780+
$ the last line of the buffer *:$*
781+
% equal to 1,$ (the entire buffer) *:%*
782+
* equal to '<,'> (the lines of the last
783+
selected Visual area; see |:star| below)
784+
'x the line of the position of mark x *:'x*
785+
(where x is any {a-z} mark)
786+
'X the line of the position of mark X *:'X*
787+
(where X is any {A-Z0-9} mark, though
788+
when X is in another buffer it cannot
789+
be used in a range)
790+
'[ the first line of the most recent *:'[*
791+
change or yank
792+
'] the last line of the most recent *:']*
793+
change or yank
794+
'< the first line of the most recently *:'<*
795+
selected Visual area
796+
'> the last line of the most recently *:'>*
797+
selected Visual area
798+
'' the line of the position before the *:''*
799+
latest jump, or where the last "m'"/"m`"
800+
command was given (though '' is 1 if it
801+
isn't in the current buffer)
802+
'" the line of the cursor position when *:'quote*
803+
last exiting the buffer
804+
'^ the line of the cursor position the *:'^*
805+
last time Insert mode was stopped
806+
'. the line of the cursor position when the *:'.*
807+
buffer was last changed
808+
'( the line of the first character of the *:'(*
809+
current sentence
810+
') the line of the first character after *:')*
811+
the end of the current sentence
812+
'{ the first empty line before the *:'{*
813+
paragraph containing the cursor
814+
'} the first empty line after the *:'}*
815+
paragraph containing the cursor
816+
/{pattern}[/] the next line where {pattern} matches *:/*
781817
also see |:range-pattern| below
782-
?{pattern}[?] the previous line where {pattern} matches *:?*
818+
?{pattern}[?] the previous line where {pattern} matches *:?*
783819
also see |:range-pattern| below
784-
\/ the next line where the previously used search
785-
pattern matches
786-
\? the previous line where the previously used search
787-
pattern matches
788-
\& the next line where the previously used substitute
789-
pattern matches
820+
\/ the next line where the most recent
821+
search pattern matches
822+
\? the previous line where the most recent
823+
search pattern matches
824+
\& the next line where the most recent
825+
substitute pattern matches
826+
827+
Note: "next line" and "previous line" do not include matches appearing
828+
in the current line.
790829

791830
*:range-offset*
792-
Each may be followed (several times) by '+' or '-' and an optional number.
793-
This number is added or subtracted from the preceding line number. If the
794-
number is omitted, 1 is used. If there is nothing before the '+' or '-' then
795-
the current line is used.
796-
*:range-closed-fold*
831+
Each line specifier may be followed by one or more '+' or '-' and an optional
832+
number. That value is added or subtracted from the preceding line number.
833+
So, for example, 'x+2 is two lines after the line containing mark x. If the
834+
number is omitted, +1 is used for each '+' and -1 for each '-' so, e.g., 'x++
835+
and 'x+2 are synonymous. If there is nothing before the '+' or '-', for the
836+
first line number in [range] the current line is used as the relative
837+
starting point. So, -,. means, "the line before the current line to the
838+
current line". The value of the second line number in [range] depends on
839+
whether a comma or semicolon separates the line numbers (see |:,| and |:;|).
840+
Examples: If the cursor is within the line below this one, any of these
841+
commands will print the tag line ":range-offset" and the line, "Each...": >
842+
:-11;+1 print
843+
:-----------,-10 print
844+
:?Each line?-;+ print
845+
:'{+,'{+2 print
846+
:'{+1;')-1 print
847+
< *:range-closed-fold*
797848
When a line number after the comma is in a closed fold it is adjusted to the
798849
last line of the fold, thus the whole fold is included.
799850

0 commit comments

Comments
 (0)