Vim9 Create its own Lambda Def Function

已查看 6 次
跳至第一个未读帖子

N i c o l a s

未读,
2023年1月11日 15:33:092023/1/11
收件人 vim_use
Hi,

Is it possible to create its own lambda function ?

I explain I got this def func :

def OutBufAdd(outbuf: list<string>, str: string)
  EchoMsg(str)
  outbuf->add(str)
enddef

Client code is using it as this :
OutBufAdd(outbuf, 'foo')
....
OutBufAdd(outbuf, 'bar')
....
OutBufAdd(outbuf, 'barfoofoo')
....
OutBufAdd(outbuf, 'barbar')

Regarding this, it is always in this case OutBufAdd(outbuf, somestring)

Is it possible to modify OutBufAdd(outbuf,  somestring  ) to OutBufAdd->(somestring) ?

Thank you for all
Nicolas



Salman Halim

未读,
2023年1月11日 16:02:302023/1/11
收件人 vim...@googlegroups.com
:help Partial

You should be able to do this or a variation thereof from here:

var Adder: func: any = function('OutBufAdd', [outfbuf])

Adder(something)

Hope this helps,

Salman 

N i c o l a s

未读,
2023年1月11日 16:18:452023/1/11
收件人 vim_use
Yess a lot it helps. Thank you Mr Halim.

Big Thank to Bram.
回复全部
回复作者
转发
0 个新帖子