lua/josean/plugins/nvim-treesitter.lua (1568B)
1 return {
2 {
3 "nvim-treesitter/nvim-treesitter",
4 event = { "BufReadPre", "BufNewFile" },
5 build = ":TSUpdate",
6 dependencies = {
7 "nvim-treesitter/nvim-treesitter-textobjects",
8 "windwp/nvim-ts-autotag",
9 },
10 config = function()
11 -- import nvim-treesitter plugin
12 local treesitter = require("nvim-treesitter.configs")
13
14 -- configure treesitter
15 treesitter.setup({ -- enable syntax highlighting
16 highlight = {
17 enable = true,
18 },
19 -- enable indentation
20 indent = { enable = true },
21 -- enable autotagging (w/ nvim-ts-autotag plugin)
22 autotag = {
23 enable = true,
24 },
25 -- ensure these language parsers are installed
26 ensure_installed = {
27 "json",
28 "javascript",
29 "typescript",
30 "tsx",
31 "yaml",
32 "html",
33 "css",
34 "prisma",
35 "markdown",
36 "markdown_inline",
37 "svelte",
38 "graphql",
39 "bash",
40 "lua",
41 "vim",
42 "dockerfile",
43 "gitignore",
44 "query",
45 },
46 incremental_selection = {
47 enable = true,
48 keymaps = {
49 init_selection = "<C-space>",
50 node_incremental = "<C-space>",
51 scope_incremental = false,
52 node_decremental = "<bs>",
53 },
54 },
55 })
56
57 -- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx
58 require('ts_context_commentstring').setup {}
59 end,
60 },
61 }