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
19 changes: 14 additions & 5 deletions doc/userfunc.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*userfunc.txt* For Vim バージョン 9.1. Last change: 2025 Oct 12
*userfunc.txt* For Vim バージョン 9.1. Last change: 2025 Oct 28


VIM リファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -182,10 +182,10 @@
! が付いていると、関数が存在していなくてもエラーが発生
しない。
*:retu* *:return* *E133*
:retu[rn] [expr] 関数から戻る。"[expr]" が与えられた場合、それは評価さ
れ関数の結果として返される。"[expr]" が与えられない場
合、数値 0 が返される。関数が明示的な ":return" を伴わ
ずに終了した場合、数値 0 が返される。
:retu[rn] [expr] 関数から戻る。[expr] が与えられた場合、それは評価され
関数の結果として返される。[expr] が与えられない場合、
数値 0 が返される。関数が明示的な ":return" を伴わずに
終了した場合、数値 0 が返される。

:def 関数内で到達不可能なコードが `:return` の後に続く
場合、 *E1095* が与えられる。
Expand Down Expand Up @@ -422,6 +422,15 @@ Note `system()` を呼ぶ前で "Outfile" 削除がスケジュールされて
範囲は使えない。関数として追加の引数付きの部分適用は使えるが、辞書は使えない。
*E1300*

|:def| 関数では、ラムダ式を |:defer| とともに使用できる。例: >

def Fn()
set lazyredraw
defer () => {
set lazyredraw&
}()
enddef
<
==============================================================================

4. 自動的に読み込まれる関数 ~
Expand Down
15 changes: 12 additions & 3 deletions en/userfunc.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*userfunc.txt* For Vim version 9.1. Last change: 2025 Oct 12
*userfunc.txt* For Vim version 9.1. Last change: 2025 Oct 28


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -189,9 +189,9 @@ See |:verbose-cmd| for more information.
With the ! there is no error if the function does not
exist.
*:retu* *:return* *E133*
:retu[rn] [expr] Return from a function. When "[expr]" is given, it is
:retu[rn] [expr] Return from a function. When [expr] is given, it is
evaluated and returned as the result of the function.
If "[expr]" is not given, the number 0 is returned.
If [expr] is not given, the number 0 is returned.
When a function ends without an explicit ":return",
the number 0 is returned.

Expand Down Expand Up @@ -449,6 +449,15 @@ or altering execution outside of deferred functions.
No range is accepted. The function can be a partial with extra arguments, but
not with a dictionary. *E1300*

In a |:def| function, a lambda can be used with |:defer|. Example: >

def Fn()
set lazyredraw
defer () => {
set lazyredraw&
}()
enddef
<
==============================================================================

4. Automatically loading functions ~
Expand Down