feat(nvim): completion sources
This commit is contained in:
parent
b133b675f0
commit
e9aeacd1e6
9 changed files with 219 additions and 103 deletions
|
|
@ -9,78 +9,6 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'saghen/blink.cmp',
|
||||
version = '1.*',
|
||||
dependencies = 'folke/lazydev.nvim',
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
event = { 'InsertEnter', 'LspAttach' },
|
||||
config = function(_, opts)
|
||||
vim.o.pumheight = 15
|
||||
opts.completion.menu.max_height = vim.o.pumheight
|
||||
|
||||
require('blink.cmp').setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
keymap = {
|
||||
['<c-p>'] = { 'select_prev' },
|
||||
['<c-n>'] = { 'show', 'select_next' },
|
||||
['<c-space>'] = {},
|
||||
['<c-y>'] = {
|
||||
function(cmp)
|
||||
return cmp.snippet_active() and cmp.accept()
|
||||
or cmp.select_and_accept()
|
||||
end,
|
||||
'snippet_forward',
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
auto_show = false,
|
||||
scrollbar = false,
|
||||
draw = {
|
||||
columns = function(ctx)
|
||||
if ctx.mode == 'cmdline' then
|
||||
return {
|
||||
{ 'label', 'label_description', gap = 1 },
|
||||
}
|
||||
else
|
||||
return {
|
||||
{ 'label', 'label_description' },
|
||||
{ 'kind' },
|
||||
}
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
cmdline = {
|
||||
enabled = false,
|
||||
-- completion = {
|
||||
-- menu = {
|
||||
-- auto_show = true,
|
||||
-- },
|
||||
-- },
|
||||
-- keymap = {
|
||||
-- ['<left>'] = false,
|
||||
-- ['<right>'] = false,
|
||||
-- },
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
module = 'lazydev.integrations.blink',
|
||||
score_offset = 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = { { '<c-n>', mode = 'i' } },
|
||||
opts_extend = { 'sources.default' },
|
||||
},
|
||||
{
|
||||
'saecki/live-rename.nvim',
|
||||
event = 'LspAttach',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue