mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 19:30:01 +02:00
touching the nvim.
This commit is contained in:
parent
15e6408670
commit
71717129e1
40 changed files with 1045 additions and 921 deletions
|
|
@ -1,81 +1,59 @@
|
|||
local icons = require('config.icons')
|
||||
return function()
|
||||
local cmp = require('cmp')
|
||||
local lspkind = require('utils.lspkind')
|
||||
local icons = require('config.icons')
|
||||
|
||||
return function ()
|
||||
local lspkind_config = {
|
||||
mode = 'symbol',
|
||||
preset = 'codicons',
|
||||
symbol_map = icons.symbols,
|
||||
maxwidth = 40,
|
||||
ellipsis_char = "...",
|
||||
}
|
||||
local cmp = require('cmp')
|
||||
local selectPrev = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
|
||||
local selectPrev = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
local borderstyle = {
|
||||
border = "none",
|
||||
winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
|
||||
}
|
||||
|
||||
local borderstyle = {
|
||||
border = "none",
|
||||
winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
|
||||
}
|
||||
|
||||
return {
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
-- enabled = function()
|
||||
-- if require"cmp.config.context".in_treesitter_capture("comment")==true or require"cmp.config.context".in_syntax_group("Comment") then
|
||||
-- return false
|
||||
-- else
|
||||
-- return true
|
||||
-- end
|
||||
-- end,
|
||||
-- preselect = false,
|
||||
view = {
|
||||
entries = { name = 'custom', selection_order = 'near_cursor' },
|
||||
},
|
||||
window = {
|
||||
documentation = borderstyle,
|
||||
completion = borderstyle
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = selectPrev,
|
||||
["<S-Tab>"] = selectPrev,
|
||||
["<Down>"] = selectNext,
|
||||
["<Tab>"] = selectNext,
|
||||
["<esc>"] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
if vim.tbl_contains({ 'path' }, entry.source.name) then
|
||||
local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label)
|
||||
if icon then
|
||||
vim_item.kind = icon
|
||||
vim_item.kind_hl_group = hl_group
|
||||
return vim_item
|
||||
end
|
||||
end
|
||||
|
||||
return require('lspkind').cmp_format(lspkind_config)(entry, vim_item)
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = "copilot" },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' }
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "NonText",
|
||||
},
|
||||
},
|
||||
}
|
||||
return {
|
||||
preselect = false,
|
||||
view = {
|
||||
entries = { name = 'custom', selection_order = 'near_cursor' },
|
||||
},
|
||||
window = {
|
||||
documentation = borderstyle,
|
||||
completion = borderstyle
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = selectPrev,
|
||||
["<S-Tab>"] = selectPrev,
|
||||
["<Down>"] = selectNext,
|
||||
["<Tab>"] = selectNext,
|
||||
["<S-c>"] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = lspkind.format({
|
||||
mode = 'symbol',
|
||||
preset = 'codicons',
|
||||
symbol_map = icons.symbols,
|
||||
maxwidth = 40,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "copilot" },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' }
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "NonText",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue