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 protocol = require 'vim.lsp.protocol'
|
||||||
local ts_utils = require 'nvim-lsp-ts-utils'
|
local ts_utils = require 'nvim-lsp-ts-utils'
|
||||||
local util = require 'lspconfig/util'
|
local util = require 'lspconfig/util'
|
||||||
local cmp = require 'cmp_nvim_lsp'
|
|
||||||
|
|
||||||
-- https://github.com/neovim/nvim-lspconfig/wiki/User-contributed-tips
|
-- https://github.com/neovim/nvim-lspconfig/wiki/User-contributed-tips
|
||||||
function FormatRangeOperator()
|
function FormatRangeOperator()
|
||||||
|
@ -175,8 +174,15 @@ local on_attach = function(client, bufnr)
|
||||||
}
|
}
|
||||||
end
|
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()
|
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 = {
|
local rust_tool_opts = {
|
||||||
tools = {
|
tools = {
|
||||||
|
@ -202,6 +208,7 @@ local rust_tool_opts = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
server = {
|
server = {
|
||||||
|
on_init = on_init,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -215,6 +222,7 @@ local rust_tool_opts = {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvim_lsp.clangd.setup {
|
nvim_lsp.clangd.setup {
|
||||||
|
on_init = on_init,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
default_config = {
|
default_config = {
|
||||||
|
@ -231,11 +239,13 @@ nvim_lsp.clangd.setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvim_lsp.hls.setup {
|
nvim_lsp.hls.setup {
|
||||||
|
on_init = on_init,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
nvim_lsp.jedi_language_server.setup {
|
nvim_lsp.jedi_language_server.setup {
|
||||||
|
on_init = on_init,
|
||||||
on_attach = on_attach_python,
|
on_attach = on_attach_python,
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
|
@ -244,6 +254,7 @@ require('rust-tools').setup(rust_tool_opts)
|
||||||
|
|
||||||
nvim_lsp.tsserver.setup {
|
nvim_lsp.tsserver.setup {
|
||||||
init_options = require("nvim-lsp-ts-utils").init_options,
|
init_options = require("nvim-lsp-ts-utils").init_options,
|
||||||
|
on_init = on_init,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,19 +16,11 @@ local init = function ()
|
||||||
use 'bronson/vim-visual-star-search'
|
use 'bronson/vim-visual-star-search'
|
||||||
-- Manage Project sessions
|
-- Manage Project sessions
|
||||||
use 'thaerkh/vim-workspace'
|
use 'thaerkh/vim-workspace'
|
||||||
-- For autocompletion
|
-- Snippets
|
||||||
use {
|
use {
|
||||||
'hrsh7th/nvim-cmp',
|
'L3MON4D3/LuaSnip',
|
||||||
requires = {
|
requires = {
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'rafamadriz/friendly-snippets',
|
||||||
'hrsh7th/cmp-nvim-lua',
|
|
||||||
'hrsh7th/cmp-buffer',
|
|
||||||
'hrsh7th/cmp-path',
|
|
||||||
'hrsh7th/cmp-cmdline',
|
|
||||||
'onsails/lspkind-nvim',
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
'saadparwaiz1/cmp_luasnip',
|
|
||||||
'rafamadriz/friendly-snippets'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-- Git support
|
-- Git support
|
||||||
|
|
Loading…
Reference in a new issue