2022-01-30 13:13:29 +00:00
|
|
|
local ok, parser_configs = pcall(require, 'nvim-treesitter.parsers')
|
|
|
|
if not ok then return end
|
|
|
|
|
2023-03-14 08:55:30 +00:00
|
|
|
-- 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.
|
2023-06-15 08:12:16 +00:00
|
|
|
-- Sadly, the solution only works on my old MacBook pro, which is a 13 inch
|
|
|
|
-- model. So my only option is to lock it down to that device.
|
2023-03-14 08:55:30 +00:00
|
|
|
if vim.loop.os_uname().sysname == 'Darwin' then
|
2023-06-15 08:12:16 +00:00
|
|
|
local meta = vim.fn.system({"system_profiler", "SPHardwareDataType"});
|
|
|
|
if not string.match(meta, "MacBookPro13,1") then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local opts = require('nvim-treesitter.install')
|
|
|
|
opts.compilers = { "zig" }
|
|
|
|
opts.command_extra_args = { "--help" }
|
2023-03-14 08:55:30 +00:00
|
|
|
end
|
|
|
|
|
2022-01-30 13:13:29 +00:00
|
|
|
local parser_configs = parser_configs.get_parser_configs()
|
2021-12-13 17:12:11 +00:00
|
|
|
|
|
|
|
parser_configs.norg = {
|
|
|
|
install_info = {
|
|
|
|
url = "https://github.com/nvim-neorg/tree-sitter-norg",
|
|
|
|
files = { "src/parser.c", "src/scanner.cc" },
|
|
|
|
branch = "main"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
ensure_installed = { "norg" }
|
|
|
|
}
|