31 lines
1.2 KiB
Django/Jinja
31 lines
1.2 KiB
Django/Jinja
-- {{ ansible_managed }}
|
|
|
|
-- To update installed parsers use `:TSUpdate {language}`.
|
|
-- See https://github.com/nvim-treesitter/nvim-treesitter for more info.
|
|
local tree_sitter_config = require('nvim-treesitter')
|
|
|
|
local ensure_installed = {
|
|
'lua', 'yaml', 'bash', 'python', 'javascript', 'typescript', 'jsx', 'css', 'scss',
|
|
'html', 'htmldjango', 'sql', 'json', 'dockerfile', 'markdown', 'rst', 'tmux',
|
|
'xml', 'toml', 'editorconfig', 'diff', 'gitcommit', 'git_config', 'gitignore',
|
|
'gitattributes', 'make', 'nginx', 'vim', 'vimdoc', 'passwd', 'regex'
|
|
}
|
|
|
|
local already_installed = require('nvim-treesitter.config').get_installed()
|
|
local parsers_to_install = vim.iter(ensure_installed)
|
|
:filter(function(parser) return not vim.tbl_contains(already_installed, parser) end)
|
|
:totable()
|
|
|
|
tree_sitter_config.install(parsers_to_install)
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
callback = function()
|
|
-- Enable treesitter highlighting and disable regex syntax
|
|
pcall(vim.treesitter.start)
|
|
-- folds, provided by Neovim
|
|
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
|
vim.wo.foldmethod = 'expr'
|
|
-- indentation, provided by nvim-treesitter
|
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
|
end,
|
|
})
|