diff --git a/lua/core/termux.lua b/lua/core/termux.lua new file mode 100644 index 0000000..044ccb6 --- /dev/null +++ b/lua/core/termux.lua @@ -0,0 +1,10 @@ +return { + is_termux = function() + if (vim.fn.getenv("TERMUX_VERSION") ~= "" and + vim.fn.isdirectory("/data/data/com.termux/files/usr") == 1) then + return true + end + + return false + end, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 60f7ff2..7b7f6e8 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -9,6 +9,13 @@ return { ensure_installed = "all", }, config = function(_, opts) + -- Don't compile all parsers on Android + local termux = require("core.termux") + if termux.is_termux() then + opts.ensure_installed = { "c", "rust", "lua" } + opts.auto_install = true + end + require("nvim-treesitter.configs").setup(opts) end, }