2022-10-19 00:47:07 +01:00
|
|
|
local present, treesitter = pcall(require, "nvim-treesitter.configs")
|
2024-02-12 15:05:56 +00:00
|
|
|
if not present then
|
|
|
|
return
|
|
|
|
end
|
2022-10-19 00:47:07 +01:00
|
|
|
|
|
|
|
require('nvim-treesitter.install').update({ with_sync = true })
|
|
|
|
|
|
|
|
|
|
|
|
local options = {
|
2024-02-12 15:05:56 +00:00
|
|
|
ensure_installed = { "c", "lua", "haskell", "rust", "markdown", "org" },
|
2022-10-19 00:47:07 +01:00
|
|
|
|
2023-01-14 04:05:17 +00:00
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
use_languagetree = true,
|
2024-02-12 15:05:56 +00:00
|
|
|
additional_vim_regex_highlighting = { "org" },
|
2023-01-14 04:05:17 +00:00
|
|
|
},
|
|
|
|
indent = {
|
|
|
|
enable = true,
|
|
|
|
},
|
2024-04-27 16:02:41 +01:00
|
|
|
textobjects = {
|
|
|
|
select = {
|
|
|
|
enable = true,
|
|
|
|
-- Automatically jump forward to textobj, similar to targets.vim
|
|
|
|
lookahead = true,
|
|
|
|
keymaps = {
|
|
|
|
-- You can use the capture groups defined in textobjects.scm
|
|
|
|
["af"] = "@function.outer",
|
|
|
|
["if"] = "@function.inner",
|
|
|
|
["ab"] = "@block.outer",
|
|
|
|
["ib"] = "@block.inner",
|
|
|
|
},
|
|
|
|
selection_modes = {
|
|
|
|
['@block.outer'] = 'v', -- charwise
|
|
|
|
['@block.inner'] = 'v', -- charwise
|
|
|
|
['@function.outer'] = 'V', -- linewise
|
|
|
|
},
|
|
|
|
include_surrounding_whitespace = true,
|
|
|
|
},
|
|
|
|
},
|
2022-10-19 00:47:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
treesitter.setup(options)
|