Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eval documents #497

Merged
merged 8 commits into from
Apr 4, 2019
143 changes: 122 additions & 21 deletions doc/eval.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*eval.txt* For Vim バージョン 8.1. Last change: 2019 Mar 02
*eval.txt* For Vim バージョン 8.1. Last change: 2019 Mar 30


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -602,6 +602,9 @@ Note 辞書の要素間に順序は定まっていない。そのため ":echo a

1.5 Blobs ~
*blob* *Blob* *Blobs* *E978*
Blobは、バイナリオブジェクトである。例えば、ファイルから画像を読んでチャンネル
を通し送信することなどに使える。

Blobは、ほとんどの場合、数値の |List| のように振る舞う。数値は、0 から 255 の
8ビットの値を持つ。

Expand Down Expand Up @@ -2218,11 +2221,12 @@ ch_status({handle} [, {options}])
changenr() 数値 現在の変更番号
char2nr({expr} [, {utf8}]) 数値 {expr}の先頭文字のASCII/UTF8コード
cindent({lnum}) 数値 {lnum}行目のCインデント量
clearmatches() なし 全マッチをクリアする
clearmatches([{win}]) なし 全マッチをクリアする
col({expr}) 数値 カーソルかマークのカラム番号
complete({startcol}, {matches}) なし 挿入モード補完を設定する
complete_add({expr}) 数値 補完候補を追加する
complete_check() 数値 補完中に押されたキーをチェックする
complete_info([{what}]) 辞書 現在の補完情報を取得
confirm({msg} [, {choices} [, {default} [, {type}]]])
数値 ユーザーへの選択肢と番号
copy({expr}) 任意 {expr}の浅いコピーを作る
Expand Down Expand Up @@ -2313,7 +2317,7 @@ getjumplist([{winnr} [, {tabnr}]])
getline({lnum}) 文字列 現在のバッファから行の内容を取得
getline({lnum}, {end}) リスト カレントバッファの{lnum}から{end}行目
getloclist({nr} [, {what}]) リスト locationリストの要素のリスト
getmatches() リスト 現在のマッチのリスト
getmatches([{win}]) リスト 現在のマッチのリスト
getpid() 数値 Vim のプロセス ID
getpos({expr}) リスト カーソル・マークなどの位置を取得
getqflist([{what}]) リスト quickfix要素のリスト
Expand Down Expand Up @@ -2409,7 +2413,7 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
数値 位置を {group} で強調表示する
matcharg({nr}) リスト |:match|の引数
matchdelete({id}) 数値 {id} で指定されるマッチを削除する
matchdelete({id} [, {win}]) 数値 {id} で指定されるマッチを削除する
matchend({expr}, {pat} [, {start} [, {count}]])
数値 {expr}内で{pat}が終了する位置
matchlist({expr}, {pat} [, {start} [, {count}]])
Expand Down Expand Up @@ -2484,10 +2488,13 @@ repeat({expr}, {count}) 文字列 {expr}を{count}回繰り返す
resolve({filename}) 文字列 ショートカットが指す先のファイル名
reverse({list}) 文字列 {list}をその場で反転させる
round({expr}) 浮動小数点数 {expr} を四捨五入する
rubyeval({expr}) 任意 |Ruby| の式を評価
screenattr({row}, {col}) 数値 スクリーン位置の属性
screenchar({row}, {col}) 数値 スクリーン位置の文字
screenchars({row}, {col}) リスト スクリーン位置の文字のリスト
screencol() 数値 現在のカーソル列
screenrow() 数値 現在のカーソル行
screenstring({row}, {col}) 文字列 スクリーン位置の文字列
search({pattern} [, {flags} [, {stopline} [, {timeout}]]])
数値 {pattern} を検索する
searchdecl({name} [, {global} [, {thisblock}]])
Expand All @@ -2513,7 +2520,7 @@ setfperm({fname}, {mode}) 数値 ファイル {fname} のパーミッション
setline({lnum}, {line}) 数値 行{lnum}に{line}(文字列)をセット
setloclist({nr}, {list} [, {action} [, {what}]])
数値 {list}を使ってlocationリストを変更
setmatches({list}) 数値 マッチのリストを復元する
setmatches({list} [, {win}]) 数値 マッチのリストを復元する
setpos({expr}, {list}) なし {expr}の位置を{list}にする
setqflist({list} [, {action} [, {what}]])
数値 {list}を使ってquickfixリストを変更
Expand Down Expand Up @@ -2648,6 +2655,7 @@ test_null_partial() Funcref テスト用のnull値
test_null_string() 文字列 テスト用のnull値
test_option_not_set({name}) なし オプション設定フラグをリセットする
test_override({expr}, {val}) なし Vimの内部処理を置き換えてテストする
test_refcount({expr}) 数値 {expr}の参照カウントを取得
test_scrollbar({which}, {value}, {dragging})
なし GUIのスクロールのテスト用
test_settime({expr}) なし テスト用に現在の時刻を設定する
Expand Down Expand Up @@ -3403,6 +3411,10 @@ char2nr({expr} [, {utf8}]) *char2nr()*
< {utf8} に 1 を指定すると、常に utf-8 文字として扱われる。
合成文字は個別の文字として扱われる。
|nr2char()| はこの逆を行う。
文字列を文字の番号のリストに変換するには: >
let str = "ABC"
let list = map(split(str, '\zs'), {_, val -> char2nr(val)})
< 結果: [65, 66, 67]

cindent({lnum}) *cindent()*
'cindent' で使われるのと同じC言語用のインデント規則に従った場
Expand All @@ -3413,9 +3425,11 @@ cindent({lnum}) *cindent()*
るときは-1を返す。
|C-indenting|を参照。

clearmatches() *clearmatches()*
|matchadd()| と コマンド |:match| により定義されたマッチをすべ
て消去する。
clearmatches([{win}]) *clearmatches()*
|matchadd()| と コマンド |:match| によりカレントウィンドウに定
義されたマッチをすべて消去する。
{win} が指定されれば、カレントウィンドウではなく指定されたウィ
ンドウあるいはウィンドウID を対象にする。

*col()*
col({expr}) 戻り値は数値で、{expr}で与えられる位置の桁番号(バイトインデッ
Expand Down Expand Up @@ -3490,6 +3504,57 @@ complete_check() *complete_check()*
しているときは|TRUE|を返す。そうでないときは0を返す。
'completefunc' で指定された関数の中でのみ使われる。

*complete_info()*
complete_info([{what}])
挿入モードの補完に関する情報を辞書で返す。|ins-completion| を
参照。
要素は以下の通り:
mode 現在の補完モード名の文字列。
値は |completion_info_mode| を参照。
pum_visible ポップアップメニューが表示されているなら |TRUE|
|pumvisible()| を参照。
items
補完マッチのリスト。各要素は "word", "abbr",
"menu", "kind", "info", "user_data" を含む辞書。
|complete-items| を参照。
selected 選択された補完候補のインデックス。最初のインデ
ックスが 0。どの補完候補も選択されていなければ
-1 (挿入されたテキストのみが表示されているとき
)。
inserted 入力された文字列。[現時点では未実装]

*complete_info_mode*
mode の値は:
"" 補完モードでない
"keyword" キーワード補完 |i_CTRL-X_CTRL-N|
"ctrl_x" CTRL-X のみが入力された |i_CTRL-X|
"whole_line" 行全体 |i_CTRL-X_CTRL-L|
"files" ファイル名 |i_CTRL-X_CTRL-F|
"tags" タグ |i_CTRL-X_CTRL-]|
"path_defines" 定義補完 |i_CTRL-X_CTRL-D|
"path_patterns" インクルード補完 |i_CTRL-X_CTRL-I|
"dictionary" 'dictionary' |i_CTRL-X_CTRL-K|
"thesaurus" 同義語 |i_CTRL-X_CTRL-T|
"cmdline" Vim コマンドライン |i_CTRL-X_CTRL-V|
"function" ユーザー定義補完 |i_CTRL-X_CTRL-U|
"omni" オムニ補完 |i_CTRL-X_CTRL-O|
"spell" スペル補完 |i_CTRL-X_s|
"eval" |complete()| による補完
"unknown" その他の内部モード

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

モード名は "~補完" で統一した方がいいかもと感じました。(お任せコース)

Copy link
Contributor Author

@hiromi-mi hiromi-mi Apr 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

モード名の末尾が「〜補完」になるように、かつモード名が簡潔なように統一してみました。

オプショナル引数としてリスト {what} が与えられると、 {what} に
ある項目のみが返る。{what} 内のサポートされていない項目は無視
される。

例: >
" 全ての項目を取得
call complete_info()
" 'mode' のみを取得
call complete_info(['mode'])
" 'mode' と 'pum_visible' のみを取得
call complete_info(['mode', 'pum_visible'])
<

*confirm()*
confirm({msg} [, {choices} [, {default} [, {type}]]])
confirm()はユーザーに選択させるためのダイアログを提供する。戻
Expand Down Expand Up @@ -4881,11 +4946,11 @@ getloclist({nr} [, {what}]) *getloclist()*
参照。


getmatches() *getmatches()*
|matchadd()| と |:match| により定義された全てのマッチの |List|
を返す。|setmatches()| は |getmatches()| で保存されたマッチの
リストを復元できるので、|getmatches()| と |setmatches()| は組
み合わせて使うと便利である
getmatches([{win}]) *getmatches()*
|matchadd()| と |:match| によりカレントウィンドウに定義された
全てのマッチの |List| を返す。|setmatches()| は |getmatches()|
で保存されたマッチのリストを復元できるので、|getmatches()| と
|setmatches()| は組み合わせて使うと便利である
例: >
:echo getmatches()
< [{'group': 'MyGroup1', 'pattern': 'TODO',
Expand Down Expand Up @@ -6205,11 +6270,12 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()*
matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
カレントウィンドウで強調表示するパターンを定義する。このパター
ンのことを「マッチ」と呼ぶ。構文グループ {group}で強調する。戻
り値は、マッチを識別する ID である。|matchdelete()|でこの ID
を指定してマッチを削除することができる。
パターンは大文字小文字を区別し、magic (|/magic|) として解釈さ
れる ({pattern} の中で明示的に変更しない限り)。オプションの
'magic'、'smartcase'、'ignorecase' は使用されない。
り値は、マッチを識別する ID である。この ID はウィンドウに紐付
けられている。|matchdelete()| でこの ID を指定してマッチを削除
することができる。この ID はウィンドウパターンは大文字小文字を
区別し、magic (|/magic|) として解釈される ({pattern} の中で明
示的に変更しない限り)。オプションの 'magic'、'smartcase'、
'ignorecase' は使用されない。
Concealは特別であり、マッチを隠す作用がある。

省略可能な引数 {priority} はマッチの優先度を指定する。優先度が
Expand Down Expand Up @@ -6297,11 +6363,13 @@ matcharg({nr}) *matcharg()*
|:match| を使った強調は 3 個までに限られている。
|matchadd()| にはこの制限はない。

matchdelete({id}) *matchdelete()* *E802* *E803*
matchdelete({id}, [, {win}]) *matchdelete()* *E802* *E803*
|matchadd()| または |:match| で定義したマッチの中で ID が {id}
であるものを削除する。成功したときは 0、失敗したときは
-1 を返す。|matchadd()| の例を参照。すべてのマッチを削除するの
は |clearmatches()| 一発でできる。
{win} が指定されれば、カレントウィンドウではなく指定されたウィ
ンドウあるいはウィンドウID を対象にする。

matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
|match()|と同じだが、返されるのはマッチした部分文字列の終了後の
Expand Down Expand Up @@ -6487,6 +6555,10 @@ nr2char({expr} [, {utf8}]) *nr2char()*
て保持している。そのため、nr2char(10)とすればNUL文字を指定でき
る。nr2char(0)は真のNUL文字(文字列の終端)となるので、空文字列
を返す。
文字の数値のリストを文字列に変換するには: >
let list = [65, 66, 67]
let str = join(map(list, {_, val -> nr2char(val)}), '')
< 結果: "ABC"

or({expr}, {expr}) *or()*
二つの引数のビット論理和。引数は数値に変換される。リスト、辞
Expand Down Expand Up @@ -7237,6 +7309,17 @@ round({expr}) *round()*
< -5.0
{|+float| 機能つきでコンパイルされたときのみ有効}

rubyeval({expr}) *rubyeval()*
Rubyの式 {expr} を評価し、その結果を Vim のデータ構造に変換し
たものを返す。
数値、浮動小数点数、文字列はそのまま返される (文字列はコピーさ
れる)。
配列は Vim の |List| 型に変換される。
ハッシュは Vim の |Dictionary| 型に変換される。
それ以外のオブジェクトは "Object#to_s" メソッドの結果の文字列
として表現される。
{|+ruby| 機能つきでコンパイルされたときのみ有効}

screenattr({row}, {col}) *screenattr()*
|screenchar()| と同様だが、属性を返す。これは他の位置の属性と
比較するのに利用できるだけの適当な数値である。
Expand All @@ -7250,6 +7333,12 @@ screenchar({row}, {col}) *screenchar()*
この関数は主にテスト用に使われる。
row か col が範囲外である場合は -1 を返す。

screenchars({row}, {col}) *screenchars()*
結果は数値のリスト。最初の数値は |screenchar()| が返す数値と同
一。それ以降の数値は基底文字に続く合成文字の数値。
この関数は主にテスト用。
row や col が範囲外である場合は空文字列を返す。

screencol() *screencol()*
現在のカーソルのスクリーン列を数値で返す。一番左の列番号は 1。
この関数は主にテスト用。
Expand All @@ -7268,6 +7357,13 @@ screenrow() *screenrow()*

Note: |screencol()| と同様の制約あり。

screenstring({row}, {col}) *screenstring()*
結果は文字列で、スクリーンの位置 [row, col] の基底文字と合成文
字全てを含む。
|screenchars()| と似ているが文字を文字列として返す。
この関数は主にテスト用。
row や col が範囲外である場合は空文字列を返す。

search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()*
正規表現パターン{pattern}を検索する。検索はカーソル位置から開
始する(検索位置を指定するには|cursor()|を使えばよい)。
Expand Down Expand Up @@ -7610,10 +7706,12 @@ setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()*
されるアイテムのみが設定される。サポートされる {what} の一覧は
|setqflist()|を参照。

setmatches({list}) *setmatches()*
setmatches({list} [, {win}]) *setmatches()*
|getmatches()| で取得したマッチのリストを復元する。成功なら 0、
失敗なら -1 を返す。リストを復元するに先立って、現在のマッチは
すべて消去される。|getmatches()| の例を参照。
{win} が指定されれば、カレントウィンドウではなく指定されたウィ
ンドウあるいはウィンドウID を対象にする。

*setpos()*
setpos({expr}, {list})
Expand Down Expand Up @@ -9339,6 +9437,10 @@ test_override({name}, {val}) *test_override()*
< "starting" の値が保存される。次のようにして復元される: >
call test_override('starting', 0)

test_refcount({expr}) *test_refcount()*
{expr} の参照カウントを返す。{expr} が参照カウントを持たない型
の場合は、-1 を返す。この関数はテスト用。

test_scrollbar({which}, {value}, {dragging}) *test_scrollbar()*
スクロールバーを使ってそれを {value} の位置に移動させる。
{which} は次のようになる:
Expand Down Expand Up @@ -10054,7 +10156,6 @@ syntax_items 現在のバッファに有効なシンタックスが設定され
system fork()/exec()の代わりにsystem()が使用されている
tag_binary タグファイル内の二分探索 |tag-binary-search|
tag_old_static 旧式の静的tagsをサポート |tag-old-static|
tag_any_white タグファイル内の空白文字をサポート |tag-any-white|
tcl TCLインターフェイスをサポート
termguicolors 端末でのtrueカラーをサポート
terminal |terminal| をサポート
Expand Down