mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-18 00:26:25 +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)")
|
return utils.t("<Plug>(completion_trigger)")
|
||||||
elseif utils.is_plugin_loaded("nvim-compe") then
|
elseif utils.is_plugin_loaded("nvim-compe") then
|
||||||
return vim.fn["compe#complete"]()
|
return vim.fn["compe#complete"]()
|
||||||
|
elseif utils.is_plugin_loaded("nvim-cmp") then
|
||||||
|
return utils.t("<Plug>(cmp_complete)")
|
||||||
else
|
else
|
||||||
return utils.t("<C-x><C-o>")
|
return utils.t("<C-x><C-o>")
|
||||||
end
|
end
|
||||||
|
@ -143,9 +143,20 @@ return require('packer').startup(function()
|
|||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- Completion
|
-- Completion
|
||||||
|
--[[
|
||||||
use {
|
use {
|
||||||
"nvim-lua/completion-nvim",
|
"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
|
-- Fuzzy Finder
|
||||||
|
@ -1,24 +1,31 @@
|
|||||||
-- TODO: Determine if keeping this
|
local M = {}
|
||||||
--[[
|
|
||||||
local function config_compe()
|
function M.config_cmp()
|
||||||
require("compe").setup{
|
vim.o.completeopt = "menuone,noinsert,noselect"
|
||||||
enabled = true,
|
local cmp = require("cmp")
|
||||||
autocomplete = true,
|
cmp.setup {
|
||||||
source = {
|
completion = {
|
||||||
path = true,
|
completeopt = "menuone,noinsert,noselect",
|
||||||
buffer = true,
|
autocomplete = false,
|
||||||
calc = true,
|
},
|
||||||
tags = true,
|
sources = {
|
||||||
spell = true,
|
{name = "nvim_lsp"},
|
||||||
nvim_lsp = true,
|
{name = "buffer"},
|
||||||
nvim_lua = true,
|
{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
|
end
|
||||||
--]]
|
|
||||||
|
|
||||||
-- TODO: Some issue with tags completion maybe compe is better?
|
-- TODO: Some issue with tags completion maybe compe is better?
|
||||||
local function config_complete()
|
function M.config_complete()
|
||||||
vim.o.completeopt = "menuone,noinsert,noselect"
|
vim.o.completeopt = "menuone,noinsert,noselect"
|
||||||
-- shortmess+=c
|
-- shortmess+=c
|
||||||
vim.g.completion_enable_auto_popup = 0
|
vim.g.completion_enable_auto_popup = 0
|
||||||
@ -31,4 +38,4 @@ local function config_complete()
|
|||||||
]])
|
]])
|
||||||
end
|
end
|
||||||
|
|
||||||
config_complete()
|
return M
|
||||||
|
@ -78,8 +78,16 @@ local function config_lsp()
|
|||||||
}
|
}
|
||||||
local lsp_config = require("lspconfig")
|
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
|
for _, ls in ipairs(language_servers) do
|
||||||
lsp_config[ls].setup{
|
lsp_config[ls].setup{
|
||||||
|
capabilities = capabilities,
|
||||||
on_attach=default_attach,
|
on_attach=default_attach,
|
||||||
settings={
|
settings={
|
||||||
pylsp={
|
pylsp={
|
||||||
|
Loading…
Reference in New Issue
Block a user