diff --git a/doc/cmdline.jax b/doc/cmdline.jax index 0db8e7611..f8d6d8fa1 100644 --- a/doc/cmdline.jax +++ b/doc/cmdline.jax @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim バージョン 9.0. Last change: 2022 Sep 26 +*cmdline.txt* For Vim バージョン 9.0. Last change: 2023 May 20 VIMリファレンスマニュアル by Bram Moolenaar @@ -491,16 +491,26 @@ tcshのautolist補完が好みなら、オプション 'wildmode' を使って :e *.c$ これは ".cpp" で終わるファイルにはマッチしない。"$" をつけないとマッチする。 -オプションの、以前に設定された値は、'=' の後で 'wildchar' のキーを打ち込むこと -で得られる。例えば、":set dir=" の後で 'wildchar' のキーを打ち込むと、'dir' の -現在の値が挿入される。この動作は、ファイル名を取るオプションに対するファイル名 -補完より優先する。 - xtermで を CTRL-P として使いたいときは、このコマンドをユーザーの .cshrc に加えること。 > xmodmap -e "keysym Tab = Tab Find" そして次を .vimrc に加えること。 > cmap [1~ +< +|:set=| を使用してオプションを設定する場合、オプションの古い値は、'=' の後で +'wildchar' のキーを打ち込むことで得られる。例えば、":set dir=" の後で +'wildchar' のキーを打ち込むと、'dir' の現在の値が挿入される。この動作は、ファ +イル名を取るオプションに対するファイル名補完より優先する。 + +|:set=|、|:set+=|、または |:set^=| を使用する場合、事前に定義された名前または +構文を持つ文字列オプション ('diffopt'、'listchars' など)、または 1 文字のフラ +グのリスト ('shortmess' など) は、'wildchar' を使用する場合に補完に使用できる +値のリストも表示する。 + +|:set-=| を使用する場合、'diffopt' や 'backupdir' などのコンマ区切りのオプショ +ンは各項目を個別に表示する。'shortmess' のようなフラグリストのオプションでは、 +古い値全体と個々のフラグの両方が表示される。それ以外の場合は、古い値全体が補完 +されるだけである。 ============================================================================== 3. Exコマンドライン *cmdline-lines* @@ -590,6 +600,7 @@ Exコマンドはいくつかの特徴を持っている。 :read ! :scscope :sign + :tabdo :tcl :tcldo :tclfile @@ -704,15 +715,54 @@ Exコマンドには、その前に行単位の範囲を指定できるものが 'T マーク Tの位置 (大文字); マーク位置が別ファイルにある ときには範囲指定には使えない /{pattern}[/] 次に {pattern} のマッチする行 (下向き) *:/* + 以下の |:range-pattern| も参照 ?{pattern}[?] 次に {pattern} のマッチする行 (上向き) *:?* + 以下の |:range-pattern| も参照 \/ 次に直前の検索パターンのマッチする行 (下向き) \? 次に直前の検索パターンのマッチする行 (上向き) \& 次に直前の置換元パターンのマッチする行 (下向き) + *:range-offset* これらの後に '+' または '-' と数値を付けてもよい (複数も可)。この数は直前の行 番号に加算または減算される。数が省略された場合は 1 が指定されたと見なされる。 もし '+' や '-' の前に何も無い場合は現在行が使われる。 - + *:range-closed-fold* +コンマの後の行番号が閉じた折り畳みにある場合、折り畳みの最後の行に調整されるた +め、折り畳み全体が含まれる。 + +数値を追加する場合は、折り畳みの最後の行を調整した後に追加される。これは、これ +らの行が範囲に追加で含まれることを意味する。例えば: > + :3,4+2print +このテキスト上だと: + 1 one ~ + 2 two ~ + 3 three ~ + 4 four FOLDED ~ + 5 five FOLDED ~ + 6 six ~ + 7 seven ~ + 8 eight ~ +4 行目と 5 行目が閉じた折り畳みである場合、最終的に 3 行目から 7 行目が表示さ +れる。7 は範囲内の "4" から来ており、閉じた折り畳みの終わりである 5 に調整さ +れ、オフセット 2 が追加される。 + +減算の例 (あまり役に立たない): > + :2,4-1print +このテキスト上だと: + 1 one ~ + 2 two ~ + 3 three FOLDED~ + 4 four FOLDED ~ + 5 five FOLDED ~ + 6 six FOLDED ~ + 7 seven ~ + 8 eight ~ +3 行目から 6 行目が閉じた折り畳みである場合、最終的に 2 行目から 6 行目が表示 +される。6 は範囲内の "4" から来ており、閉じた折り畳みの終わりである 6 に調整さ +れ、1 が減算される。この場合、これはまだ閉じた折り畳みにあり、その折り畳みの最 +後の行である 6 が使用される。 + + *:range-pattern* {pattern} の後の "/" と "?" は、パターンとその後の項目とを区別するために必要と なる。 @@ -878,9 +928,10 @@ Note: これらは文字通りに打ち込まれる、これらは特別なキ たは読み書き用のファイル名に置き換えられる。 *E495* *:* ** 自動コマンドの実行時、カレントバッファの番号に置き換えられ - る (":r file" と ":so file" のときにもカレントバッファの番 - 号に置き換えられる。読み込まれているファイルはバッファ内に - ない) *E496* + る。すべてのイベントに設定されるわけではない。|bufnr()| も + 参照すること。":r file" および ":so file" の場合、これはカ + レントバッファであり、読み込まれるファイルはバッファ内にな + い。 *E496* *:* ** 自動コマンドの実行時、この自動コマンドが実行されたときのマッ チに置き換えられる。 *E497* diff --git a/en/cmdline.txt b/en/cmdline.txt index 8b3787010..3d63b1964 100644 --- a/en/cmdline.txt +++ b/en/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 9.0. Last change: 2022 Sep 26 +*cmdline.txt* For Vim version 9.0. Last change: 2023 May 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -517,16 +517,26 @@ example, to match only files that end in ".c": > :e *.c$ This will not match a file ending in ".cpp". Without the "$" it does match. -The old value of an option can be obtained by hitting 'wildchar' just after -the '='. For example, typing 'wildchar' after ":set dir=" will insert the -current value of 'dir'. This overrules file name completion for the options -that take a file name. - If you would like using for CTRL-P in an xterm, put this command in your .cshrc: > xmodmap -e "keysym Tab = Tab Find" And this in your .vimrc: > :cmap [1~ +< *complete-set-option* +When setting an option using |:set=|, the old value of an option can be +obtained by hitting 'wildchar' just after the '='. For example, typing +'wildchar' after ":set dir=" will insert the current value of 'dir'. This +overrules file name completion for the options that take a file name. + +When using |:set=|, |:set+=|, or |:set^=|, string options that have +pre-defined names or syntax (e.g. 'diffopt', 'listchars') or are a list of +single-character flags (e.g. 'shortmess') will also present a list of possible +values for completion when using 'wildchar'. + +When using |:set-=|, comma-separated options like 'diffopt' or 'backupdir' +will show each item separately. Flag list options like 'shortmess' will show +both the entire old value and the individual flags. Otherwise completion will +just fill in with the entire old value. ============================================================================== 3. Ex command-lines *cmdline-lines* @@ -617,6 +627,7 @@ followed by another Vim command: :read ! :scscope :sign + :tabdo :tcl :tcldo :tclfile @@ -736,7 +747,9 @@ Line numbers may be specified with: *:range* *{address}* 'T position of mark T (uppercase); when the mark is in another file it cannot be used in a range /{pattern}[/] the next line where {pattern} matches *:/* + also see |:range-pattern| below ?{pattern}[?] the previous line where {pattern} matches *:?* + also see |:range-pattern| below \/ the next line where the previously used search pattern matches \? the previous line where the previously used search @@ -744,11 +757,49 @@ Line numbers may be specified with: *:range* *{address}* \& the next line where the previously used substitute pattern matches + *:range-offset* Each may be followed (several times) by '+' or '-' and an optional number. This number is added or subtracted from the preceding line number. If the number is omitted, 1 is used. If there is nothing before the '+' or '-' then the current line is used. - + *:range-closed-fold* +When a line number after the comma is in a closed fold it is adjusted to the +last line of the fold, thus the whole fold is included. + +When a number is added this is done after the adjustment to the last line of +the fold. This means these lines are additionally included in the range. For +example: > + :3,4+2print +On this text: + 1 one ~ + 2 two ~ + 3 three ~ + 4 four FOLDED ~ + 5 five FOLDED ~ + 6 six ~ + 7 seven ~ + 8 eight ~ +Where lines four and five are a closed fold, ends up printing lines 3 to 7. +The 7 comes from the "4" in the range, which is adjusted to the end of the +closed fold, which is 5, and then the offset 2 is added. + +An example for subtracting (which isn't very useful): > + :2,4-1print +On this text: + 1 one ~ + 2 two ~ + 3 three FOLDED~ + 4 four FOLDED ~ + 5 five FOLDED ~ + 6 six FOLDED ~ + 7 seven ~ + 8 eight ~ +Where lines three to six are a closed fold, ends up printing lines 2 to 6. +The 6 comes from the "4" in the range, which is adjusted to the end of the +closed fold, which is 6, and then 1 is subtracted, then this is still in the +closed fold and the last line of that fold is used, which is 6. + + *:range-pattern* The "/" and "?" after {pattern} are required to separate the pattern from anything that follows. @@ -804,7 +855,7 @@ always be swapped then. Count and Range *N:* -When giving a count before entering ":", this is translated into: +When giving a count before entering ":", this is translated into: > :.,.+(count - 1) In words: The "count" lines at and after the cursor. Example: To delete three lines: > @@ -921,9 +972,10 @@ Note: these are typed literally, they are not special keys! write. *E495* *:* ** When executing autocommands, is replaced with the currently - effective buffer number (for ":r file" and ":so file" it is - the current buffer, the file being read/sourced is not in a - buffer). *E496* + effective buffer number. It is not set for all events, + also see |bufnr()|. For ":r file" and ":so file" it is the + current buffer, the file being read/sourced is not in a + buffer. *E496* *:* ** When executing autocommands, is replaced with the match for which this autocommand was executed. *E497*