Files
nix-los/config/nvim/lua/eliaskohout/plugins/nvim-treesitter.lua
T

28 lines
1.2 KiB
Lua

-- Highlight, edit, and navigate code
return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
event = { 'BufReadPost', 'BufNewFile' },
cmd = { 'TSInstall', 'TSUpdate', 'TSUninstall' },
config = function()
vim.api.nvim_create_autocmd('VimEnter', {
callback = function()
local installed = require('nvim-treesitter.config').get_installed()
local wanted = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'python', 'go' }
local to_install = vim.tbl_filter(function(lang)
return not vim.list_contains(installed, lang)
end, wanted)
if #to_install > 0 then
vim.cmd.TSInstall({ args = to_install, bang = true })
end
end,
})
end,
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
}