0
" As above, but curry the arguments so only the buffer number is required.
function! ale#VarFunc(variable_name) abort
    return {buf -> ale#Var(buf, a:variable_name)}
endfunction

What does { buf -> ... } mean? It seems like a kind of function closure, but I can't find any document about this... :(

2
  • 2
    it is a lambda expression, see :h lambda
    – doraemon
    Nov 22, 2018 at 6:17
  • Oh, thanks man! You saved me! By the way, could you make it an answer?
    – lfree
    Nov 22, 2018 at 6:22

1 Answer 1

4

It is a lambda expression, see :h lambda.

The type of it is v:t_func.

It can be used where a Funcref is needed, see :h Funcref. For example, as the parameter of map() and filter().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.