skip heavyweight plugins on termux
This commit is contained in:
+16
-10
@@ -22,20 +22,22 @@ vim.keymap.set('n', '<C-L>', '<C-W><C-L>')
|
||||
vim.keymap.set('', '<C-c>', '"+y<CR>')
|
||||
|
||||
-- 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
|
||||
return '<cr>'
|
||||
end, { expr=true })
|
||||
end, { expr=true })
|
||||
|
||||
-- coc.nvim - use <Tab> / <S-Tab> to navigate completion list
|
||||
vim.keymap.set('i', '<Tab>', function()
|
||||
-- coc.nvim - use <Tab> / <S-Tab> to navigate completion list
|
||||
vim.keymap.set('i', '<Tab>', function()
|
||||
if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#next'](1) end
|
||||
return '<Tab>'
|
||||
end, { expr=true })
|
||||
vim.keymap.set('i', '<S-Tab>', function()
|
||||
end, { expr=true })
|
||||
vim.keymap.set('i', '<S-Tab>', function()
|
||||
if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#prev'](1) end
|
||||
return '<S-Tab>'
|
||||
end, { expr=true })
|
||||
end, { expr=true })
|
||||
end
|
||||
|
||||
-- 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)
|
||||
@@ -53,7 +55,8 @@ vim.api.nvim_create_autocmd(
|
||||
)
|
||||
|
||||
-- treesitter
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
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.
|
||||
@@ -65,10 +68,13 @@ require'nvim-treesitter.configs'.setup {
|
||||
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")
|
||||
|
||||
@@ -7,13 +7,23 @@ 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'
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user