skip heavyweight plugins on termux

This commit is contained in:
2026-09-14 07:47:18 -04:00
parent 4131ac8e93
commit 5623db1090
2 changed files with 45 additions and 31 deletions
+16 -10
View File
@@ -22,20 +22,22 @@ vim.keymap.set('n', '<C-L>', '<C-W><C-L>')
vim.keymap.set('', '<C-c>', '"+y<CR>') vim.keymap.set('', '<C-c>', '"+y<CR>')
-- coc.nvim - remap <cr> to make it confirm completion. -- coc.nvim - remap <cr> to make it confirm completion.
vim.keymap.set('i', '<cr>', function() if not vim.g.is_termux then
vim.keymap.set('i', '<cr>', function()
if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#confirm']() end if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#confirm']() end
return '<cr>' return '<cr>'
end, { expr=true }) end, { expr=true })
-- coc.nvim - use <Tab> / <S-Tab> to navigate completion list -- coc.nvim - use <Tab> / <S-Tab> to navigate completion list
vim.keymap.set('i', '<Tab>', function() vim.keymap.set('i', '<Tab>', function()
if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#next'](1) end if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#next'](1) end
return '<Tab>' return '<Tab>'
end, { expr=true }) end, { expr=true })
vim.keymap.set('i', '<S-Tab>', function() vim.keymap.set('i', '<S-Tab>', function()
if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#prev'](1) end if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#prev'](1) end
return '<S-Tab>' return '<S-Tab>'
end, { expr=true }) end, { expr=true })
end
-- Code search? https://news.ycombinator.com/item?id=41739452 -- Code search? https://news.ycombinator.com/item?id=41739452
vim.keymap.set('n', 'gv', '<c-w>v<cmd>lua vim.lsp.buf.definition()<CR>', opts) vim.keymap.set('n', 'gv', '<c-w>v<cmd>lua vim.lsp.buf.definition()<CR>', opts)
@@ -53,7 +55,8 @@ vim.api.nvim_create_autocmd(
) )
-- treesitter -- treesitter
require'nvim-treesitter.configs'.setup { if not vim.g.is_termux then
require'nvim-treesitter.configs'.setup {
highlight = { highlight = {
enable = true, enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time. -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
@@ -65,10 +68,13 @@ require'nvim-treesitter.configs'.setup {
indent = { indent = {
enable = true enable = true
} }
} }
end
-- Install coc extensions -- 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 -- Turn on nice things
vim.opt.clipboard:append("unnamedplus") vim.opt.clipboard:append("unnamedplus")
+10 -2
View File
@@ -7,13 +7,23 @@ end
-- Only required if you have packer configured as `opt` -- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]] 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) return require('packer').startup(function(use)
-- Packer can manage itself -- Packer can manage itself
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
if not is_termux then
-- LSP / COMPLETION -- -- LSP / COMPLETION --
use {'neoclide/coc.nvim', branch = "release"} use {'neoclide/coc.nvim', branch = "release"}
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
end
-- automatically adjust tab based on current file -- automatically adjust tab based on current file
use 'tpope/vim-sleuth' use 'tpope/vim-sleuth'
@@ -25,8 +35,6 @@ return require('packer').startup(function(use)
use 'lukas-reineke/indent-blankline.nvim' use 'lukas-reineke/indent-blankline.nvim'
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
-- Automatically set up your configuration after cloning packer.nvim -- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins -- Put this at the end after all plugins
if packer_bootstrap then if packer_bootstrap then