nvim/lua/plugins/nvim-treesitter.lua

73 lines
2.1 KiB
Lua

return {
"nvim-treesitter/nvim-treesitter",
event = { "InsertEnter" },
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag",
},
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
-- configure treesitter
treesitter.setup({ -- enable syntax highlighting
auto_install = true,
highlight = {
enable = true,
},
-- enable indentation
indent = { enable = true },
-- enable autotagging (w/ nvim-ts-autotag plugin)
autotag = {
enable = true,
},
-- ensure these language parsers are installed
ensure_installed = {
"json",
"javascript",
"yaml",
"html",
"markdown",
"markdown_inline",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
"query",
"latex",
"python",
"c",
"cpp",
"css",
"commonlisp",
"fennel",
"haskell",
"ini",
"jq",
"perl",
"scss",
"verilog",
"awk"
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
-- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx
context_commentstring = {
enable = true,
enable_autocmd = false,
},
})
vim.api.nvim_set_keymap('n', '<space>jd', ':TSD<CR>', { noremap = true, silent = true })
end,
}