neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

query.lua (994B)


      1 -- Neovim filetype plugin file
      2 -- Language:	Treesitter query
      3 
      4 if vim.b.did_ftplugin == 1 then
      5  return
      6 end
      7 
      8 -- Do not set vim.b.did_ftplugin = 1 to allow loading of ftplugin/lisp.vim
      9 
     10 -- use treesitter over syntax
     11 vim.treesitter.start()
     12 
     13 -- set omnifunc
     14 vim.bo.omnifunc = 'v:lua.vim.treesitter.query.omnifunc'
     15 
     16 vim.opt_local.iskeyword:append('.')
     17 
     18 -- query linter
     19 local buf = vim.api.nvim_get_current_buf()
     20 local query_lint_on = vim.g.query_lint_on or {}
     21 
     22 if not vim.b.disable_query_linter and #query_lint_on > 0 then
     23  vim.api.nvim_create_autocmd(query_lint_on, {
     24    group = vim.api.nvim_create_augroup('nvim.querylint', { clear = false }),
     25    buffer = buf,
     26    callback = function()
     27      vim.treesitter.query.lint(buf)
     28    end,
     29    desc = 'Query linter',
     30  })
     31 end
     32 
     33 -- it's a lisp!
     34 vim.cmd([[runtime! ftplugin/lisp.vim]])
     35 
     36 vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl omnifunc< iskeyword<'
     37 vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()'