mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-17 22:46:26 +00:00
nvim: use nvim-cmp for completion
This commit is contained in:
parent
48af6cc3ef
commit
4a5d7fce1e
@ -51,6 +51,8 @@ function _G.complete_space()
|
||||
return utils.t("<Plug>(completion_trigger)")
|
||||
elseif utils.is_plugin_loaded("nvim-compe") then
|
||||
return vim.fn["compe#complete"]()
|
||||
elseif utils.is_plugin_loaded("nvim-cmp") then
|
||||
return utils.t("<Plug>(cmp_complete)")
|
||||
else
|
||||
return utils.t("<C-x><C-o>")
|
||||
end
|
||||
|
@ -143,9 +143,20 @@ return require('packer').startup(function()
|
||||
--]]
|
||||
|
||||
-- Completion
|
||||
--[[
|
||||
use {
|
||||
"nvim-lua/completion-nvim",
|
||||
config = function() require("utils").require_with_local("plugins.completion") end,
|
||||
config = function() require("plugins.completion").config_complete() end,
|
||||
}
|
||||
--]]
|
||||
use {
|
||||
"hrsh7th/nvim-cmp",
|
||||
config = function() require("plugins.completion").config_cmp() end,
|
||||
requires = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"f3fora/cmp-spell",
|
||||
}
|
||||
}
|
||||
|
||||
-- Fuzzy Finder
|
||||
|
@ -1,24 +1,31 @@
|
||||
-- TODO: Determine if keeping this
|
||||
--[[
|
||||
local function config_compe()
|
||||
require("compe").setup{
|
||||
enabled = true,
|
||||
autocomplete = true,
|
||||
source = {
|
||||
path = true,
|
||||
buffer = true,
|
||||
calc = true,
|
||||
tags = true,
|
||||
spell = true,
|
||||
nvim_lsp = true,
|
||||
nvim_lua = true,
|
||||
local M = {}
|
||||
|
||||
function M.config_cmp()
|
||||
vim.o.completeopt = "menuone,noinsert,noselect"
|
||||
local cmp = require("cmp")
|
||||
cmp.setup {
|
||||
completion = {
|
||||
completeopt = "menuone,noinsert,noselect",
|
||||
autocomplete = false,
|
||||
},
|
||||
sources = {
|
||||
{name = "nvim_lsp"},
|
||||
{name = "buffer"},
|
||||
{name = "spell"},
|
||||
},
|
||||
}
|
||||
|
||||
-- Add a plug mapping to use in C-Space binding
|
||||
vim.api.nvim_set_keymap(
|
||||
"i",
|
||||
"<Plug>(cmp_complete)",
|
||||
"<cmd>lua require('cmp').complete()<CR>",
|
||||
{silent = true, noremap = true}
|
||||
)
|
||||
end
|
||||
--]]
|
||||
|
||||
-- TODO: Some issue with tags completion maybe compe is better?
|
||||
local function config_complete()
|
||||
function M.config_complete()
|
||||
vim.o.completeopt = "menuone,noinsert,noselect"
|
||||
-- shortmess+=c
|
||||
vim.g.completion_enable_auto_popup = 0
|
||||
@ -31,4 +38,4 @@ local function config_complete()
|
||||
]])
|
||||
end
|
||||
|
||||
config_complete()
|
||||
return M
|
||||
|
@ -78,8 +78,16 @@ local function config_lsp()
|
||||
}
|
||||
local lsp_config = require("lspconfig")
|
||||
|
||||
-- Maybe update capabilities
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
if utils.is_plugin_loaded("cmp-nvim-lsp") then
|
||||
capabilities = require("cmp_nvim_lsp").update_capabilities(
|
||||
capabilities, {snippetSupport = false})
|
||||
end
|
||||
|
||||
for _, ls in ipairs(language_servers) do
|
||||
lsp_config[ls].setup{
|
||||
capabilities = capabilities,
|
||||
on_attach=default_attach,
|
||||
settings={
|
||||
pylsp={
|
||||
|
Loading…
Reference in New Issue
Block a user