summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core/treesitter.lua
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-08 23:13:05 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-08 23:13:05 +0100
commitc9e2adbbc8fd7a5398c8c66d21f0e02dc7b60203 (patch)
tree274263ba15e0197180af8bb681e22c4780d5de05 /.config/nvim/lua/core/treesitter.lua
parente4ea22e223bbd6b4091610c6fa093862cbd32f75 (diff)
Add new lunarvin updates
Diffstat (limited to '.config/nvim/lua/core/treesitter.lua')
-rw-r--r--.config/nvim/lua/core/treesitter.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/.config/nvim/lua/core/treesitter.lua b/.config/nvim/lua/core/treesitter.lua
index 59adda4..b56c245 100644
--- a/.config/nvim/lua/core/treesitter.lua
+++ b/.config/nvim/lua/core/treesitter.lua
@@ -1,4 +1,3 @@
-
local M = {}
local Log = require "core.log"
@@ -17,8 +16,17 @@ M.config = function()
disable = { "latex" },
},
context_commentstring = {
- enable = false,
- config = { css = "// %s" },
+ enable = true,
+ config = {
+ -- Languages that have a single comment style
+ typescript = "// %s",
+ css = "/* %s */",
+ scss = "/* %s */",
+ html = "<!-- %s -->",
+ svelte = "<!-- %s -->",
+ vue = "<!-- %s -->",
+ json = "",
+ },
},
-- indent = {enable = true, disable = {"python", "html", "javascript"}},
-- TODO seems to be broken
@@ -72,7 +80,11 @@ M.setup = function()
return
end
- treesitter_configs.setup(options.builtin.treesitter)
+ local opts = vim.deepcopy(options.builtin.treesitter)
+
+ -- avoid running any installers in headless mode since it's harder to detect failures
+ opts.ensure_installed = #vim.api.nvim_list_uis() == 0 and {} or opts.ensure_installed
+ treesitter_configs.setup(opts)
if options.builtin.treesitter.on_config_done then
options.builtin.treesitter.on_config_done(treesitter_configs)