Hi Ag.,
> My only question is (from :help lua-vim):
>
> vim.open({fname}) Opens a new buffer for file {fname} and
> returns it. Note that the buffer
> is not set as current.
>
> And then few lines below:
>
> :lua vim.open"myfile"() -- open buffer and set it as current
>
>
> They both work as advertised, but why this idiom? Is there any other way
> to have the same result, but to be a little bit less confusing?
> If there is a reason to stay like this, at least (for me), it looks more
> natural exactly the opposite, so:
>
> lua vim.open('somefile')
>
> it should open the file and set is as current.
I guess I've overused the syntactic sugar. The line
:lua vim.open"myfile"()
is equivalent to
:lua local b = vim.open("myfile"); b()
that is, b is the new buffer for myfile and b() sets it as the current buffer.
I didn't want to force vim.open to set the buffer to be current as that might
not be what the user wants.
Thanks for taking the time and testing if_lua!
Cheers,
Luis.
--
Computers are useless. They can only give you answers.
-- Pablo Picasso
--
Luis Carvalho (Kozure)
lua -e 'print((("[EMAIL PROTECTED]"):gsub("(%u+%.)","")))'
signature.asc
Description: Digital signature
