feat: use ts-install.nvim to automatically install parsers
This commit is contained in:
parent
58170c7ae3
commit
95beada08d
16
init.lua
16
init.lua
|
|
@ -874,8 +874,6 @@ require('lazy').setup({
|
||||||
branch = 'main',
|
branch = 'main',
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
||||||
config = function()
|
config = function()
|
||||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
|
||||||
require('nvim-treesitter').install(parsers)
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local buf, filetype = args.buf, args.match
|
local buf, filetype = args.buf, args.match
|
||||||
|
|
@ -899,6 +897,20 @@ require('lazy').setup({
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{ -- Automatically install Treesitter parsers for languages you encounter.
|
||||||
|
|
||||||
|
-- NOTE: This plugin is a convenience feature and is not strictly necessary for
|
||||||
|
-- regular use. If you prefer, you can remove it and install parsers manually
|
||||||
|
-- directly with treesitter using `require('nvim-treesitter').install()`.
|
||||||
|
'lewis6991/ts-install.nvim',
|
||||||
|
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||||
|
config = function()
|
||||||
|
require('ts-install').setup {
|
||||||
|
ensure_install = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||||
|
auto_install = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue