aboutsummaryrefslogtreecommitdiffstats
path: root/neovim
diff options
context:
space:
mode:
Diffstat (limited to 'neovim')
-rw-r--r--neovim/.config/nvim/lua/plugins/treesitter.lua24
1 files changed, 22 insertions, 2 deletions
diff --git a/neovim/.config/nvim/lua/plugins/treesitter.lua b/neovim/.config/nvim/lua/plugins/treesitter.lua
index 875500f..37320d4 100644
--- a/neovim/.config/nvim/lua/plugins/treesitter.lua
+++ b/neovim/.config/nvim/lua/plugins/treesitter.lua
@@ -3,7 +3,7 @@ return {
3 branch = "main", 3 branch = "main",
4 build = ":TSUpdate", 4 build = ":TSUpdate",
5 config = function() 5 config = function()
6 require("nvim-treesitter").install({ 6 local parsers = {
7 "lua", 7 "lua",
8 "vim", 8 "vim",
9 "vimdoc", 9 "vimdoc",
@@ -21,7 +21,27 @@ return {
21 "json", 21 "json",
22 "markdown", 22 "markdown",
23 "markdown_inline", 23 "markdown_inline",
24 }) 24 }
25
26 -- The `main` branch shells out to the `tree-sitter` CLI to build every
27 -- parser. Without it every single parser fails the same way, which
28 -- floods :messages with one error per parser on every startup — check
29 -- once up front and give a single, actionable warning instead.
30 if vim.fn.executable("tree-sitter") == 0 then
31 vim.notify(
32 "nvim-treesitter: 'tree-sitter' CLI not found on PATH, parsers "
33 .. "won't build (e.g. `brew install tree-sitter-cli` or "
34 .. "`npm install -g tree-sitter-cli`), then :TSUpdate.",
35 vim.log.levels.WARN
36 )
37 else
38 local ok, err = pcall(function()
39 require("nvim-treesitter").install(parsers)
40 end)
41 if not ok then
42 vim.notify("nvim-treesitter: parser install failed: " .. tostring(err), vim.log.levels.WARN)
43 end
44 end
25 45
26 -- Enable highlighting for any buffer whose filetype has an installed 46 -- Enable highlighting for any buffer whose filetype has an installed
27 -- parser; vim.treesitter.start() is a no-op (caught by pcall) otherwise. 47 -- parser; vim.treesitter.start() is a no-op (caught by pcall) otherwise.