nvim: Drop nvim-cmp
Auto-completion has mostly been annoying than of any actual use. Just fancy annoying crap. Just use in built omni completion.
This commit is contained in:
parent
20c3b7dd7d
commit
8e0fdbdaae
3 changed files with 16 additions and 96 deletions
|
@ -1,83 +0,0 @@
|
|||
local cmp = require 'cmp'
|
||||
local lspkind = require 'lspkind'
|
||||
local luasnip = require 'luasnip'
|
||||
|
||||
-- https://github.com/hrsh7th/nvim-cmp/issues/180#issuecomment-915405589
|
||||
luasnip.config.set_config { history = true }
|
||||
require('luasnip.loaders.from_vscode').load {}
|
||||
|
||||
cmp.setup {
|
||||
preselect = cmp.PreselectMode.None,
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,noinsert',
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'kind', 'abbr', 'menu' },
|
||||
format = lspkind.cmp_format({
|
||||
with_text = true,
|
||||
menu = ({
|
||||
buffer = '[Buffer]',
|
||||
nvim_lsp = '[Lsp]',
|
||||
nvim_lua = '[Lua]',
|
||||
path = '[Path]',
|
||||
luasnip = '[Snippet]',
|
||||
})
|
||||
}),
|
||||
},
|
||||
snippet = {
|
||||
expand = function (args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
documentation = {
|
||||
border = 'rounded'
|
||||
},
|
||||
mapping = {
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{
|
||||
name = 'nvim_lsp',
|
||||
priority = 100
|
||||
},
|
||||
{
|
||||
name = 'luasnip',
|
||||
priority = 80
|
||||
},
|
||||
{
|
||||
name = 'nvim_lua',
|
||||
priority = 50
|
||||
},
|
||||
{
|
||||
name = 'buffer',
|
||||
priority = 20
|
||||
},
|
||||
{
|
||||
name = 'path',
|
||||
priority = 5
|
||||
},
|
||||
},
|
||||
experimental = {
|
||||
native_menu = false,
|
||||
ghost_text = { hl_group = 'Hint' },
|
||||
}
|
||||
}
|
||||
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
|
@ -2,7 +2,6 @@ local nvim_lsp = require 'lspconfig'
|
|||
local protocol = require 'vim.lsp.protocol'
|
||||
local ts_utils = require 'nvim-lsp-ts-utils'
|
||||
local util = require 'lspconfig/util'
|
||||
local cmp = require 'cmp_nvim_lsp'
|
||||
|
||||
-- https://github.com/neovim/nvim-lspconfig/wiki/User-contributed-tips
|
||||
function FormatRangeOperator()
|
||||
|
@ -175,8 +174,15 @@ local on_attach = function(client, bufnr)
|
|||
}
|
||||
end
|
||||
|
||||
local on_init = function(client)
|
||||
if client.config.settings then
|
||||
client.notify('workspace/didChangeConfiguration', { settings = client.config.settings })
|
||||
end
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = cmp.update_capabilities(capabilities)
|
||||
capabilities.workspace.configuration = true
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local rust_tool_opts = {
|
||||
tools = {
|
||||
|
@ -202,6 +208,7 @@ local rust_tool_opts = {
|
|||
}
|
||||
},
|
||||
server = {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
|
@ -215,6 +222,7 @@ local rust_tool_opts = {
|
|||
}
|
||||
|
||||
nvim_lsp.clangd.setup {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
default_config = {
|
||||
|
@ -231,11 +239,13 @@ nvim_lsp.clangd.setup {
|
|||
}
|
||||
|
||||
nvim_lsp.hls.setup {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
nvim_lsp.jedi_language_server.setup {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach_python,
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
@ -244,6 +254,7 @@ require('rust-tools').setup(rust_tool_opts)
|
|||
|
||||
nvim_lsp.tsserver.setup {
|
||||
init_options = require("nvim-lsp-ts-utils").init_options,
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
|
|
@ -16,19 +16,11 @@ local init = function ()
|
|||
use 'bronson/vim-visual-star-search'
|
||||
-- Manage Project sessions
|
||||
use 'thaerkh/vim-workspace'
|
||||
-- For autocompletion
|
||||
-- Snippets
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
requires = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-nvim-lua',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'onsails/lspkind-nvim',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'rafamadriz/friendly-snippets'
|
||||
'rafamadriz/friendly-snippets',
|
||||
}
|
||||
}
|
||||
-- Git support
|
||||
|
|
Loading…
Reference in a new issue