Files
neovim/runtime/ftplugin/lua.lua
Justin M. Keyes 726d1a92d2 feat(options): lua closure/function options
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>
2026-07-31 21:50:04 +02:00

11 lines
368 B
Lua

-- use treesitter over syntax
vim.treesitter.start()
vim.bo.includeexpr = [[v:lua.require'vim._ftplugin.lua'.includeexpr(v:fname)]]
vim.bo.omnifunc = vim.lua_omnifunc
vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
.. '\n call v:lua.vim.treesitter.stop()'
.. '\n setl omnifunc< foldexpr< includeexpr<'