skip heavyweight plugins on termux
This commit is contained in:
@@ -22,6 +22,7 @@ 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.
|
||||||
|
if not vim.g.is_termux then
|
||||||
vim.keymap.set('i', '<cr>', function()
|
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>'
|
||||||
@@ -36,6 +37,7 @@ 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,6 +55,7 @@ vim.api.nvim_create_autocmd(
|
|||||||
)
|
)
|
||||||
|
|
||||||
-- treesitter
|
-- treesitter
|
||||||
|
if not vim.g.is_termux then
|
||||||
require'nvim-treesitter.configs'.setup {
|
require'nvim-treesitter.configs'.setup {
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
@@ -66,9 +69,12 @@ require'nvim-treesitter.configs'.setup {
|
|||||||
enable = true
|
enable = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
-- Install coc extensions
|
-- Install coc extensions
|
||||||
|
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'}
|
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")
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user