You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

120 lines
4.3 KiB

return {
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
{ "nvim-treesitter/nvim-treesitter-textobjects" },
},
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
-- configure treesitter
treesitter.setup({
-- ensure these language parsers are installed
ensure_installed = {
"json",
"javascript",
"typescript",
"tsx",
"yaml",
"html",
"css",
"prisma",
"markdown",
"markdown_inline",
"svelte",
"graphql",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
"php",
"latex",
},
ignore_install = {},
modules = {},
sync_install = true,
auto_install = true,
highlight = {
enable = true,
disable = { "latex" }
},
indent = { enable = true },
autotag = { enable = true },
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@conditional.outer",
["ic"] = "@conditional.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
},
selection_modes = {
['@parameter.outer'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
['@class.outer'] = '<c-v>', -- blockwise
},
include_surrounding_whitespace = false,
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]f"] = "@function.outer",
["]c"] = "@conditional.outer",
["]o"] = "@loop.outer",
},
goto_next_end = {
["]F"] = "@function.outer",
["]C"] = "@conditional.outer",
["]O"] = "@loop.outer",
},
goto_previous_start = {
["[f"] = "@function.outer",
["[c"] = "@conditional.outer",
["[o"] = "@loop.outer",
},
goto_previous_end = {
["[F"] = "@function.outer",
["[C"] = "@conditional.outer",
["[O"] = "@loop.outer",
},
goto_next = {
["]b"] = "@block.outer",
},
goto_previous = {
["[b"] = "@block.outer",
}
},
},
})
---@class ParserConfig
---@field install_info table
---@field filetype string
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
files = { "src/parser.c" },
branch = "main",
},
filetype = "blade",
}
vim.filetype.add({
pattern = {
[".*%.blade%.php"] = "blade",
},
})
end,
},
}