treesitter fix
This commit is contained in:
parent
f7cd5d261d
commit
1951582c84
40
init.lua
40
init.lua
|
|
@ -855,32 +855,15 @@ require('lazy').setup({
|
||||||
|
|
||||||
{ -- Highlight, edit, and navigate code
|
{ -- Highlight, edit, and navigate code
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
config = function()
|
|
||||||
local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
|
||||||
require('nvim-treesitter').install(filetypes)
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
pattern = filetypes,
|
|
||||||
callback = function() vim.treesitter.start() end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
config = function()
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
require('nvim-treesitter').setup {
|
||||||
opts = {
|
|
||||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'nu' },
|
|
||||||
-- Autoinstall languages that are not installed
|
|
||||||
auto_install = true,
|
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true, -- Enable syntax highlighting
|
||||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
|
||||||
-- If you are experiencing weird indenting issues, add the language to
|
|
||||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
|
||||||
additional_vim_regex_highlighting = { 'ruby' },
|
|
||||||
},
|
},
|
||||||
indent = { enable = true, disable = { 'ruby' } },
|
|
||||||
-- OPTIONAL!! These enable ts-specific textobjects.
|
-- OPTIONAL!! These enable ts-specific textobjects.
|
||||||
-- So you can hit `yaf` to copy the closest function,
|
-- So you can hit `yaf` to copy the closest function,
|
||||||
-- `dif` to clear the contet of the closest function,
|
-- `dif` to clear the content of the closest function,
|
||||||
-- or whatever keys you map to what query.
|
-- or whatever keys you map to what query.
|
||||||
textobjects = {
|
textobjects = {
|
||||||
select = {
|
select = {
|
||||||
|
|
@ -904,13 +887,14 @@ require('lazy').setup({
|
||||||
}, -- keymaps
|
}, -- keymaps
|
||||||
}, -- select
|
}, -- select
|
||||||
}, -- textobjects
|
}, -- textobjects
|
||||||
},
|
}
|
||||||
-- There are additional nvim-treesitter modules that you can use to interact
|
local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'nu' }
|
||||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
require('nvim-treesitter').install(filetypes)
|
||||||
--
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
pattern = filetypes,
|
||||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
callback = function() vim.treesitter.start() end,
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
})
|
||||||
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue