From 5623db1090bae819e12dcf58ed492cc3bac87e05 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Mon, 14 Sep 2026 07:47:18 -0400 Subject: [PATCH] skip heavyweight plugins on termux --- dot_config/nvim/init.lua | 60 ++++++++++++++++++--------------- dot_config/nvim/lua/plugins.lua | 16 ++++++--- 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index 536ab6b..c6dbc20 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -22,20 +22,22 @@ vim.keymap.set('n', '', '') vim.keymap.set('', '', '"+y') -- coc.nvim - remap to make it confirm completion. -vim.keymap.set('i', '', function() - if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#confirm']() end - return '' -end, { expr=true }) +if not vim.g.is_termux then + vim.keymap.set('i', '', function() + if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#confirm']() end + return '' + end, { expr=true }) --- coc.nvim - use / to navigate completion list -vim.keymap.set('i', '', function() - if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#next'](1) end - return '' -end, { expr=true }) -vim.keymap.set('i', '', function() - if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#prev'](1) end - return '' -end, { expr=true }) + -- coc.nvim - use / to navigate completion list + vim.keymap.set('i', '', function() + if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#next'](1) end + return '' + end, { expr=true }) + vim.keymap.set('i', '', function() + if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#prev'](1) end + return '' + end, { expr=true }) +end -- Code search? https://news.ycombinator.com/item?id=41739452 vim.keymap.set('n', 'gv', 'vlua vim.lsp.buf.definition()', opts) @@ -53,22 +55,26 @@ vim.api.nvim_create_autocmd( ) -- treesitter -require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - indent = { - enable = true - } -} +if not vim.g.is_termux then + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true + } + } +end -- Install coc extensions -vim.g.coc_global_extensions = {'coc-json', 'coc-lua', 'coc-pyright', 'coc-rust-analyzer', 'coc-yaml', 'coc-eslint'} +if not vim.g.is_termux then + vim.g.coc_global_extensions = {'coc-json', 'coc-lua', 'coc-pyright', 'coc-rust-analyzer', 'coc-yaml', 'coc-eslint'} +end -- Turn on nice things vim.opt.clipboard:append("unnamedplus") diff --git a/dot_config/nvim/lua/plugins.lua b/dot_config/nvim/lua/plugins.lua index 0f31f9b..748cd2c 100644 --- a/dot_config/nvim/lua/plugins.lua +++ b/dot_config/nvim/lua/plugins.lua @@ -7,12 +7,22 @@ end -- Only required if you have packer configured as `opt` vim.cmd [[packadd packer.nvim]] +-- Skip heavyweight plugins (LSP completion, treesitter) on resource-constrained +-- environments like Termux, where they're slow/flaky to install and build and +-- generally unnecessary for quick edits. Termux sets $TERMUX_VERSION natively. +local is_termux = os.getenv('TERMUX_VERSION') ~= nil +vim.g.is_termux = is_termux + return require('packer').startup(function(use) -- Packer can manage itself use 'wbthomason/packer.nvim' - -- LSP / COMPLETION -- - use {'neoclide/coc.nvim', branch = "release"} + if not is_termux then + -- LSP / COMPLETION -- + use {'neoclide/coc.nvim', branch = "release"} + + use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} + end -- automatically adjust tab based on current file use 'tpope/vim-sleuth' @@ -25,8 +35,6 @@ return require('packer').startup(function(use) use 'lukas-reineke/indent-blankline.nvim' - use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} - -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if packer_bootstrap then