diff --git a/doc/syntax.jax b/doc/syntax.jax index 3a293c997..046fc9ee0 100644 --- a/doc/syntax.jax +++ b/doc/syntax.jax @@ -1,4 +1,4 @@ -*syntax.txt* For Vim バージョン 9.0. Last change: 2022 Dec 26 +*syntax.txt* For Vim バージョン 9.0. Last change: 2023 Apr 24 VIMリファレンスマニュアル by Bram Moolenaar @@ -215,9 +215,10 @@ NOTE: 長い行があって表示が遅く、構文ハイライトをオフに プからハイライトグループにリンクされ、ハイライトグループに対して色が設定され る。構文グループそれ自体は、色や属性を指定するものではない。 -ハイライトや構文のグループ名はASCII文字、数字、アンダースコアだけでつけなけれ -ばならない。正規表現では: "[a-zA-Z0-9_]*" しかしそれ以外の文字を使ってもVim -はエラーを出力しない。グループ名の最大長は約200バイトである。 E1249* +ハイライトや構文のグループ名はASCII文字、数字、アンダースコア、ドット、または +ハイフンだけでつけなければならない。正規表現では: "[a-zA-Z0-9_.-]*" しかしそ +れ以外の文字を使ってもVimはエラーを出力しない。グループ名の最大長は約200バイト +である。 *E1249* 各ユーザーが好みの色セットを使用できるように、多くの言語に共通するハイライトグ ループには優先名が与えられている。推奨されているグループ名は以下のとおり(構文 @@ -582,7 +583,7 @@ CSS を使うようになる。 存している。 *g:html_use_input_for_pc* -デフォルト: "fallback" +デフォルト: "none" |g:html_prevent_copy| の値が空文字列でないとき: "all" なら、コピー抑制エリアにある通常テキストの代わりに読み込み専用の @@ -1274,19 +1275,33 @@ DocBook のバージョンを指定できる: > DOSバッチファイル *dosbatch.vim* *ft-dosbatch-syntax* -DOSバッチファイルのハイライトにはオプションが1つある。このオプションにより -Windows 2000で導入されたコマンドインタープリターの新しい拡張機能がサポートさ -れ、変数dosbatch_cmdextversionによりその有効/無効が制御される。Windows NTでは -値1を設定し、Windows 2000では2を設定するのが良い。次のようにすれば使用するバー -ジョンを選択できる: > +変数 dosbatch_cmdextversion でサポートされる Windows コマンドインタープリター +拡張機能のセットを選択する。Windows NT のバージョン (Windows 2000 より前) の場 +合、この値は 1 である必要がある。Windows 2000 以降の場合、値は 2 である必要が +ある。 +次のようにすれば使用するバージョンを選択できる: > :let dosbatch_cmdextversion = 1 -変数が定義されていない際のデフォルトはWindows 2000をサポートする2となる。 +変数が定義されていない際のデフォルトは、Windows 2000 以降をサポートする 2 とな +る。 + +オリジナルの MS-DOS では、コメント行を入力する代替手段としてダブルコロン(::) +を使うイディオムをサポートしている。このイディオムは現在の Windows コマンドイ +ンタープリタでも使えるが、( ... ) コマンドブロックの中で使うと問題になることが +ある。これについては Stack Overflow で議論されている - -2番目のオプションは、*.btm ファイルを "dosbatch" (MS-DOS バッチファイル) タイ -プか "btm" (4DOS バッチファイル) タイプのどちらと判定するかを指定する。デフォ -ルトでは後者が使われる。前者を使うには、次のようにする: > +https://stackoverflow.com/questions/12407800/which-comment-style-should-i-use-in-batch-files + +Windows コマンドインタープリタでのコメントや MS-DOS の bat ファイルでの作業で +:: イディオムを使えるようにするには、dosbatch_colons_comment 変数を何かに設定 +する: > + + :let dosbatch_colons_comment = 1 + +.btm ファイルを "dosbatch" タイプ (MS-DOS バッチファイル) として検出する +か、"btm" タイプ (4DOS バッチファイル) として検出するかを指定するオプションが +ある。デフォルトでは後者が使用される。以下の行で前者を選択することができる: > :let g:dosbatch_syntax_for_btm = 1 @@ -1528,8 +1543,10 @@ FORM用の既定の拡張カラーモードではヘッダー命令とFORMプロ FORTH *forth.vim* *ft-forth-syntax* -"*.fs" にマッチするファイルのタイプは F# か Forth である。自動判別がうまく機能 -しない場合、または F# ファイルを一切編集しない場合は、vimrcでこれを使用する: > +".f" にマッチするファイルは Fortran か Forth で、"*.fs" にマッチするファイルは +F# か Forth である。自動検出がうまくいかない場合や、F# や Fortran をまったく編 +集しない場合は、スタートアップの vimrc でこれを使用する: > + :let filetype_f = "forth" :let filetype_fs = "forth" @@ -2070,11 +2087,11 @@ LPCはシンプルでメモリ効率的な言語、Lars Pensjö Cの略である :let lpc_syntax_for_c = 1 これでも適切に動作しないCまたはLPCのファイルに対してはモードラインを使うこと。 -LPCファイルには: +LPCファイルには: > // vim:set ft=lpc: -LPCと認識されてしまうCファイルには: +LPCと認識されてしまうCファイルには: > // vim:set ft=c: @@ -2106,7 +2123,7 @@ LUA *lua.vim* *ft-lua-syntax* Lua 構文ファイルはバージョン 4.0, 5.0, 5.1, 5.2 に対して使える (5.2 がデフォル ト) グローバル変数 lua_version と lua_subversion を設定することでバージョンを 指定することができる。例えば、Lua 5.1 の構文ハイライトを有効にするには次のよう -に変数を設定する: +に変数を設定する: > :let lua_version = 5 :let lua_subversion = 1 @@ -2680,14 +2697,20 @@ doctest とその中のコードのハイライト: > :let python_no_doctest_highlight = 1 または > :let python_no_doctest_code_highlight = 1 -(最初のオプションは二番目のオプションも含む)。 +最初のオプションは 2 番目のオプションも含む。 行末の空白と、スペースとタブの混在のハイライト: > :let python_space_error_highlight = 1 -全てのハイライトを有効化させるには (最後に挙げたオプションを有効化し、他のオプ -ションを無効化するのと同じ): > +全てのハイライトを有効化させるには: > :let python_highlight_all = 1 +これは python_space_error_highlight を設定し、他のすべての設定を解除するのと同 +じ効果がある。 + +Python 2 や straddling code (Python 2 と 3 の互換性) を使っている場合、Python 2 +と Python 3.5 までをサポートした古い構文ファイルの使用を強制することができる > + :let python_use_python2_syntax = 1 +このオプションは、最新の Python 3.6 以上の機能をすべて除外する。 Note: 変数が定義されているかどうかが意味を持つ。値は関係ない。設定値は 1 以外 でも構わない。 @@ -3603,11 +3626,11 @@ ZSH *zsh.vim* *ft-zsh-syntax* 構文アイテムには3つのタイプがある。 1. キーワード (Keyword) - これはオプション 'iskeyword' で定義されるキーワード文字だけからなる。他の構 - 文要素を含むことはできない。完全な単語(マッチの前後にキーワード文字が存在し - ない)にのみマッチする。キーワード "if" は "if(a=b)" にはマッチする - が、"ifdef x" にはマッチしない。"(" はキーワード文字でなく、"d" はキーワー - ド文字だから。 + キーワード文字は、|:syn-iskeyword| または 'iskeyword' オプションで指定され + た文字に従ってのみ含むことができる。他の構文項目を含むことはできない。完全 + な単語でのみマッチする (マッチの前後にキーワード文字がない)。キーワード + "if" は、"if(a=b)" ではマッチするが、"ifdef x" ではマッチしない。"(" はキー + ワード文字ではなく、"d" はキーワード文字だからである。 2. マッチ (Match) 単一の正規表現パターンにマッチする。 @@ -3709,7 +3732,7 @@ SYNTAX ISKEYWORD SETTING *:syn-iskeyword* clear: シンタックス固有の iskeyword の設定を無効にし、 バッファローカルの 'iskeyword' 設定を有効にする。 - {option} シンタックスの 'iskeyword' オプション値を設定する。 + {option} シンタックスの 'iskeyword' オプション値を設定する。 例: > :syntax iskeyword @,48-57,192-255,$,_ @@ -5084,7 +5107,7 @@ guisp={color-name} *highlight-guisp* guifgは文字色、guibgは背景色、guispは波線および取り消し線の色を指定す る。これらはGUIで使用される。 いくつか特別な名前がある: - NONE no color (透明) + NONE no color (透明) *E1361* bg 通常の背景色を使う background 通常の背景色を使う fg 通常の文字色を使う @@ -5153,7 +5176,7 @@ ColorColumn 'colorcolumn' で設定された列の表示に使われる *hl-Conceal* Conceal Conceal されたテキストの代わりに表示される代替文字の表示に使わ れる ('conceallevel' 参照)。 - *hl-Cursor* + *hl-Cursor* *hl-lCursor* Cursor カーソル下の文字。 lCursor |language-mapping| が使用されているときのカーソルの下の文字 ('guicursor' を参照)。 @@ -5231,6 +5254,14 @@ Normal 通常のテキスト。 Pmenu ポップアップメニュー: 通常の項目。 *hl-PmenuSel* PmenuSel ポップアップメニュー: 選択されている項目。 + *hl-PmenuKind* +PmenuKind ポップアップメニュー: "kind" の通常の項目。 + *hl-PmenuKindSel* +PmenuKindSel ポップアップメニュー: "kind" の選択されている項目。 + *hl-PmenuExtra* +PmenuExtra ポップアップメニュー: "extra text" の通常の項目。 + *hl-PmenuExtraSel* +PmenuExtraSel ポップアップメニュー: "extra text" の選択されている項目。 *hl-PmenuSbar* PmenuSbar ポップアップメニュー: スクロールバー。 *hl-PmenuThumb* diff --git a/en/syntax.txt b/en/syntax.txt index 27c65dacc..057d20158 100644 --- a/en/syntax.txt +++ b/en/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 9.0. Last change: 2022 Dec 26 +*syntax.txt* For Vim version 9.0. Last change: 2023 Apr 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -214,10 +214,10 @@ A syntax group name is to be used for syntax items that match the same kind of thing. These are then linked to a highlight group that specifies the color. A syntax group name doesn't specify any color or attributes itself. -The name for a highlight or syntax group must consist of ASCII letters, digits -and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give -an error when using other characters. The maximum length of a group name is -about 200 bytes. *E1249* +The name for a highlight or syntax group must consist of ASCII letters, +digits, underscores, dots, or hyphens. As a regexp: "[a-zA-Z0-9_.-]*". +However, Vim does not give an error when using other characters. The maximum +length of a group name is about 200 bytes. *E1249* To be able to allow each user to pick their favorite set of colors, there must be preferred names for highlight groups that are common for many languages. @@ -596,7 +596,7 @@ The method used to prevent copying in the generated page depends on the value of |g:html_use_input_for_pc|. *g:html_use_input_for_pc* -Default: "fallback" +Default: "none" If |g:html_prevent_copy| is non-empty, then: When "all", read-only elements are used in place of normal text for @@ -1307,18 +1307,32 @@ When not set 4 is used. DOSBATCH *dosbatch.vim* *ft-dosbatch-syntax* -There is one option with highlighting DOS batch files. This covers new -extensions to the Command Interpreter introduced with Windows 2000 and -is controlled by the variable dosbatch_cmdextversion. For Windows NT -this should have the value 1, and for Windows 2000 it should be 2. +Select the set of Windows Command interpreter extensions that should be +supported with the variable dosbatch_cmdextversion. For versions of Windows +NT (before Windows 2000) this should have the value of 1. For Windows 2000 +and later it should be 2. Select the version you want with the following line: > :let dosbatch_cmdextversion = 1 If this variable is not defined it defaults to a value of 2 to support -Windows 2000. +Windows 2000 and later. -A second option covers whether *.btm files should be detected as type +The original MS-DOS supports an idiom of using a double colon (::) as an +alternative way to enter a comment line. This idiom can be used with the +current Windows Command Interpreter, but it can lead to problems when used +inside ( ... ) command blocks. You can find a discussion about this on +Stack Overflow - + +https://stackoverflow.com/questions/12407800/which-comment-style-should-i-use-in-batch-files + +To allow the use of the :: idiom for comments in the Windows Command +Interpreter or working with MS-DOS bat files, set the +dosbatch_colons_comment variable to anything: > + + :let dosbatch_colons_comment = 1 + +There is an option that covers whether *.btm files should be detected as type "dosbatch" (MS-DOS batch files) or type "btm" (4DOS batch files). The latter is used by default. You may select the former with the following line: > @@ -1565,9 +1579,10 @@ example, FORM files, use this in your startup vimrc: > FORTH *forth.vim* *ft-forth-syntax* -Files matching "*.fs" could be F# or Forth. If the automatic detection -doesn't work for you, or you don't edit F# at all, use this in your -startup vimrc: > +Files matching "*.f" could be Fortran or Forth and those matching "*.fs" could +be F# or Forth. If the automatic detection doesn't work for you, or you don't +edit F# or Fortran at all, use this in your startup vimrc: > + :let filetype_f = "forth" :let filetype_fs = "forth" @@ -2145,11 +2160,11 @@ should set a variable in your .vimrc file: > :let lpc_syntax_for_c = 1 If it doesn't work properly for some particular C or LPC files, use a -modeline. For a LPC file: +modeline. For a LPC file: > // vim:set ft=lpc: -For a C file that is recognized as LPC: +For a C file that is recognized as LPC: > // vim:set ft=c: @@ -2181,7 +2196,7 @@ LUA *lua.vim* *ft-lua-syntax* The Lua syntax file can be used for versions 4.0, 5.0, 5.1 and 5.2 (5.2 is the default). You can select one of these versions using the global variables lua_version and lua_subversion. For example, to activate Lua -5.1 syntax highlighting, set the variables like this: +5.1 syntax highlighting, set the variables like this: > :let lua_version = 5 :let lua_subversion = 1 @@ -2777,17 +2792,25 @@ For highlighted doctests and code inside: > :let python_no_doctest_highlight = 1 or > :let python_no_doctest_code_highlight = 1 -(first option implies second one). +The first option implies the second one. For highlighted trailing whitespace and mix of spaces and tabs: > :let python_space_error_highlight = 1 -If you want all possible Python highlighting (the same as setting the -preceding last option and unsetting all other ones): > +If you want all possible Python highlighting: > :let python_highlight_all = 1 +This has the same effect as setting python_space_error_highlight and +unsetting all the other ones. + +If you use Python 2 or straddling code (Python 2 and 3 compatible), +you can enforce the use of an older syntax file with support for +Python 2 and up to Python 3.5. > + :let python_use_python2_syntax = 1 +This option will exclude all modern Python 3.6 or higher features. + +Note: Only existence of these options matters, not their value. + You can replace 1 above with anything. -Note: Only existence of these options matter, not their value. You can replace - 1 above with anything. QUAKE *quake.vim* *ft-quake-syntax* @@ -3726,11 +3749,12 @@ The syntax script for zsh allows for syntax-based folding: > Vim understands three types of syntax items: 1. Keyword - It can only contain keyword characters, according to the 'iskeyword' - option. It cannot contain other syntax items. It will only match with a - complete word (there are no keyword characters before or after the match). - The keyword "if" would match in "if(a=b)", but not in "ifdef x", because - "(" is not a keyword character and "d" is. + It can only contain keyword characters, according to the characters + specified with |:syn-iskeyword| or the 'iskeyword' option. It cannot + contain other syntax items. It will only match with a complete word (there + are no keyword characters before or after the match). The keyword "if" + would match in "if(a=b)", but not in "ifdef x", because "(" is not a + keyword character and "d" is. 2. Match This is a match with a single regexp pattern. @@ -3836,7 +3860,7 @@ SYNTAX ISKEYWORD SETTING *:syn-iskeyword* clear: Syntax specific iskeyword setting is disabled and the buffer-local 'iskeyword' setting is used. - {option} Set the syntax 'iskeyword' option to a new value. + {option} Set the syntax 'iskeyword' option to a new value. Example: > :syntax iskeyword @,48-57,192-255,$,_ @@ -4906,7 +4930,7 @@ is mostly used, because it looks better. ============================================================================== 13. Colorschemes *color-schemes* -In the next section you can find information about indivisual highlight groups +In the next section you can find information about individual highlight groups and how to specify colors for them. Most likely you want to just select a set of colors by using the `:colorscheme` command, for example: > @@ -5283,7 +5307,7 @@ guisp={color-name} *highlight-guisp* (guisp) color to use in the GUI. "guisp" is used for undercurl and strikethrough. There are a few special names: - NONE no color (transparent) + NONE no color (transparent) *E1361* bg use normal background color background use normal background color fg use normal foreground color @@ -5356,7 +5380,7 @@ ColorColumn Used for the columns set with 'colorcolumn'. *hl-Conceal* Conceal Placeholder characters substituted for concealed text (see 'conceallevel'). - *hl-Cursor* + *hl-Cursor* *hl-lCursor* Cursor Character under the cursor. lCursor Character under the cursor when |language-mapping| is used (see 'guicursor'). @@ -5430,6 +5454,14 @@ Normal Normal text. Pmenu Popup menu: Normal item. *hl-PmenuSel* PmenuSel Popup menu: Selected item. + *hl-PmenuKind* +PmenuKind Popup menu: Normal item "kind". + *hl-PmenuKindSel* +PmenuKindSel Popup menu: Selected item "kind". + *hl-PmenuExtra* +PmenuExtra Popup menu: Normal item "extra text". + *hl-PmenuExtraSel* +PmenuExtraSel Popup menu: Selected item "extra text". *hl-PmenuSbar* PmenuSbar Popup menu: Scrollbar. *hl-PmenuThumb*