diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-09-19 16:12:26 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2020-09-19 20:05:22 +0200 |
| commit | e31cbdc13daede0ebe2a2bf4cc1f9eee183a8ad6 (patch) | |
| tree | 6d0b6f844e1fe31acacacb5ab9dc83cee48ef34c | |
| parent | fix: only concatenate cmd.err if not nil (diff) | |
| download | nvim-treesitter-e31cbdc13daede0ebe2a2bf4cc1f9eee183a8ad6.tar nvim-treesitter-e31cbdc13daede0ebe2a2bf4cc1f9eee183a8ad6.tar.gz nvim-treesitter-e31cbdc13daede0ebe2a2bf4cc1f9eee183a8ad6.tar.bz2 nvim-treesitter-e31cbdc13daede0ebe2a2bf4cc1f9eee183a8ad6.tar.lz nvim-treesitter-e31cbdc13daede0ebe2a2bf4cc1f9eee183a8ad6.tar.xz nvim-treesitter-e31cbdc13daede0ebe2a2bf4cc1f9eee183a8ad6.tar.zst nvim-treesitter-e31cbdc13daede0ebe2a2bf4cc1f9eee183a8ad6.zip | |
feat(install): make compiler selectable
Compilers are selectable via 'nvim-treesitter.install'.compilers (list of compilers) or environment variable CC
Addresses #502
| -rw-r--r-- | lua/nvim-treesitter/install.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index d0ee118a1..3fbd74722 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -8,6 +8,8 @@ local info = require'nvim-treesitter.info' local M = {} +M.compilers = { vim.fn.getenv('CC'), "cc", "gcc", "clang" } + function M.iter_cmd(cmd_list, i, lang, success_message) if i == #cmd_list + 1 then return print(success_message) end @@ -130,10 +132,11 @@ local function run_install(cache_folder, install_folder, lang, repo, with_sync) local compile_location = cache_folder..path_sep..(repo.location or project_name) local parser_lib_name = install_folder..path_sep..lang..".so" - local compilers = { "cc", "gcc", "clang" } - local cc = select_executable(compilers) + local cc = select_executable(M.compilers) if not cc then - api.nvim_err_writeln('No C compiler found! "'..table.concat(compilers, '", "')..'" are not executable.') + api.nvim_err_writeln('No C compiler found! "' + ..table.concat(vim.tbl_filter(function(c) return type(c) == 'string' end, M.compilers), '", "') + ..'" are not executable.') return end |
