Merge pull request 'replaced nvim-compe with nvim-cmp' (#6) from nvim-cmp-upgrade into main

Reviewed-on: https://git.softinio.com/softinio/nix-config/pulls/6
This commit is contained in:
Salar Rahmanian 2022-08-13 23:59:29 +00:00
commit 62d5238255

View file

@ -30,8 +30,20 @@ local function load_plugins()
use 'lukas-reineke/indent-blankline.nvim' use 'lukas-reineke/indent-blankline.nvim'
use { 'lewis6991/gitsigns.nvim', requires = 'nvim-lua/plenary.nvim' } use { 'lewis6991/gitsigns.nvim', requires = 'nvim-lua/plenary.nvim' }
use { 'TimUntersberger/neogit', requires = { { 'nvim-lua/plenary.nvim' }, { 'sindrets/diffview.nvim' } } } use { 'TimUntersberger/neogit', requires = { { 'nvim-lua/plenary.nvim' }, { 'sindrets/diffview.nvim' } } }
use { 'hrsh7th/nvim-compe', requires = 'L3MON4D3/LuaSnip' } -- Autocompletion plugin use {
use {'tzachar/compe-tabnine', run='./install.sh', requires = 'hrsh7th/nvim-compe'} 'hrsh7th/nvim-cmp',
requires = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-nvim-lsp-signature-help',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
}
}
use {'tzachar/cmp-tabnine', run='./install.sh', requires = 'hrsh7th/nvim-cmp'}
use 'kevinhwang91/nvim-bqf' use 'kevinhwang91/nvim-bqf'
use 'mfussenegger/nvim-dap' use 'mfussenegger/nvim-dap'
use 'mfussenegger/nvim-dap-python' use 'mfussenegger/nvim-dap-python'
@ -39,7 +51,6 @@ local function load_plugins()
use {'theHamsta/nvim-dap-virtual-text'} use {'theHamsta/nvim-dap-virtual-text'}
use 'sheerun/vim-polyglot' use 'sheerun/vim-polyglot'
use 'scalameta/nvim-metals' use 'scalameta/nvim-metals'
use 'ray-x/lsp_signature.nvim'
use 'b3nj5m1n/kommentary' use 'b3nj5m1n/kommentary'
use 'ckipp01/stylua-nvim' use 'ckipp01/stylua-nvim'
use 'gennaro-tedesco/nvim-jqx' use 'gennaro-tedesco/nvim-jqx'
@ -60,10 +71,6 @@ _G.load_config = function()
-- nvim-autopairs -- nvim-autopairs
require('nvim-autopairs').setup() require('nvim-autopairs').setup()
require('nvim-autopairs.completion.compe').setup({
map_cr = true,
map_complete = true
})
-- nvim-dap -- nvim-dap
local dap = require('dap') local dap = require('dap')
@ -371,8 +378,6 @@ _G.load_config = function()
-- LSP settings -- LSP settings
local nvim_lsp = require 'lspconfig' local nvim_lsp = require 'lspconfig'
local on_attach = function(_client, bufnr) local on_attach = function(_client, bufnr)
require('lsp_signature').on_attach()
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
@ -492,33 +497,30 @@ _G.load_config = function()
-- Set completeopt to have a better completion experience -- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noinsert' vim.o.completeopt = 'menuone,noinsert'
-- Compe setup -- nvim-cmp
require('compe').setup { local cmp_autopairs = require('nvim-autopairs.completion.cmp')
enabled = true, local cmp = require("cmp")
autocomplete = true, cmp.setup {
debug = false, snippet = {
min_length = 1, expand = function(args)
preselect = 'enable', require('luasnip').lsp_expand(args.body)
throttle_time = 80, end,
source_timeout = 200,
incomplete_delay = 400,
max_abbr_width = 100,
max_kind_width = 100,
max_menu_width = 100,
documentation = true,
source = {
path = true,
nvim_lsp = {
priority = 1000,
filetypes = { 'scala', 'sbt', 'java', 'python' },
},
nvim_lua = true,
buffer = true,
luasnip = true,
tabnine = true,
}, },
sources = {
{ name = "nvim_lsp", priority = 10 },
{ name = "buffer" },
{ name = "luasnip" },
{ name = "cmp_tabnine" },
{ name = "path" },
{ name = 'nvim_lua' },
{ name = 'nvim_lsp_signature_help' }
}
} }
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
--
local t = function(str) local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true) return vim.api.nvim_replace_termcodes(str, true, true, true)
@ -542,7 +544,7 @@ _G.load_config = function()
elseif check_back_space() then elseif check_back_space() then
return t '<Tab>' return t '<Tab>'
else else
return vim.fn['compe#complete']() return vim.fn['cmp#complete']()
end end
end end
_G.s_tab_complete = function() _G.s_tab_complete = function()