From f9c86ee14df5af3d468bbba38746f984e31ce721 Mon Sep 17 00:00:00 2001 From: Alyxia Sother Date: Tue, 14 Mar 2023 09:55:30 +0100 Subject: [PATCH] [nvim] Add a fix for Treesitter on macOS --- nvim/plugin/treesitter.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nvim/plugin/treesitter.lua b/nvim/plugin/treesitter.lua index 65cb02e..63cb55c 100644 --- a/nvim/plugin/treesitter.lua +++ b/nvim/plugin/treesitter.lua @@ -1,6 +1,18 @@ local ok, parser_configs = pcall(require, 'nvim-treesitter.parsers') if not ok then return end +-- Should only really run on my Macbook, as it is my only macOS device. +-- Apple's C compilers seem to not want to compile any of Treesitter's +-- dialects. +-- That is, `cc`, `gcc`, `g++`, andsoforth. Funnily enough, they are all +-- aliases to the same program. +-- So, the nix-darwin configuration specifies the installation of zig as a +-- replacement compiler solely so the Treesitter dialects compile. Very +-- intuitive. +if vim.loop.os_uname().sysname == 'Darwin' then + require('nvim-treesitter.install').compilers = { "zig" } +end + local parser_configs = parser_configs.get_parser_configs() parser_configs.norg = {