Problem:
Cannot assign Lua functions/closures to "func" ('completefunc',
'tagfun', …) or "expr" ('foldexpr', 'indentexpr', …) options.
Solution:
- Store "func"/"expr" options as `Callback` instead of string.
- Delete oceans of copy-pasted code.
- BREAKING: LuaRef returned via RPC/Vimscript is now represented as
`"<Lua N: file:line>"` (like what `:map` shows) instead of `nil`.
- Note: `man.vim` still uses `v:lua` string, bc it's a vimscript ftplugin.
Helped-by: Lewis Russell <lewis6991@gmail.com>
Problem:
Vimscript ftplugins that inherit a base ftplugin often use explicit
`runtime! ftplugin/foo.vim` patterns. This skips corresponding Lua
ftplugins, unlike top-level ftplugin loading.
Solution:
Use the existing `{vim,lua}` patterns for bang runtime imports while
preserving each call's current lookup breadth.
Problem:
`:help dev-name-common` states that "buf" should be used instead of
"buffer" but there are cases where buffer is mentioned in the lua API.
Solution:
- Rename occurrences of "buffer" to "buf" for consistency with the
documentation.
- Support (but deprecate) "buffer" for backwards compatibility.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
This was added before there was a dedicated language server for
tree-sitter queries. Now that https://github.com/ribru17/ts_query_ls
exists, this is a better option in every regard (and up to now
required manually disabling the builtin linter to avoid duplicate
diagnostics and performance issues).
It seems that nvim-treesitter stops treesitter highlight when changing
filetype, so it makes sense for builtin ftplugins to do this as well.
Use :call and v:lua here to allow separation with '|'.