Files
neovim/runtime/ftplugin/query.lua
Justin M. Keyes ed47b27ad4 backport: feat(api): rename buffer to buf (#38899)
feat(api): rename buffer to buf

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: Jordan <46637683+JordanllHarper@users.noreply.github.com>
2026-04-09 01:23:13 +00:00

38 lines
991 B
Lua

-- Neovim filetype plugin file
-- Language: Treesitter query
if vim.b.did_ftplugin == 1 then
return
end
-- Do not set vim.b.did_ftplugin = 1 to allow loading of ftplugin/lisp.vim
-- use treesitter over syntax
vim.treesitter.start()
-- set omnifunc
vim.bo.omnifunc = 'v:lua.vim.treesitter.query.omnifunc'
vim.opt_local.iskeyword:append('.')
-- query linter
local buf = vim.api.nvim_get_current_buf()
local query_lint_on = vim.g.query_lint_on or {}
if not vim.b.disable_query_linter and #query_lint_on > 0 then
vim.api.nvim_create_autocmd(query_lint_on, {
group = vim.api.nvim_create_augroup('nvim.querylint', { clear = false }),
buf = buf,
callback = function()
vim.treesitter.query.lint(buf)
end,
desc = 'Query linter',
})
end
-- it's a lisp!
vim.cmd([[runtime! ftplugin/lisp.vim]])
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl omnifunc< iskeyword<'
vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()'