lua: add vim.fn.{func} for direct access to vimL function #11302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a direct implementation of calling a vimL function from lua.
This fixes some typing issues due to the indirect conversion via the API. float values are preserved as such, fixes #9389, as well as empty dicts/arrays (ideally these should be distinguishable by a metatable, which is the canonical way of creating table "subtypes" and far less intrusive than
{[true] = 7, [false] = 3}thing). I might revisit this and other typing issues (such as a dedicatedvim.NILvalue asnildoesn't always work) in a followingvim.rpcrequestPR (which is my next lua addition, for a full "rpc client lib" in lua code).Also add convenient lua interface as
vim.funcs.fname(...). The namefuncsis fully bikeshedable. @norcalli has also suggested a similar interface as part of his "stdlib" work but insteadnvim.fn.xx, though it would bevim.fnhere if we use it. In fact perhaps this should be the only public interface, andvim.callinstead bevim._callimplementation detail.