mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-07-23 03:54:33 +02:00
enc: add colorfull cmp, add new simple icon, enhance odeium config
This commit is contained in:
parent
be2518be72
commit
6d87fbb90a
5 changed files with 93 additions and 17 deletions
|
@ -2,8 +2,52 @@ return {
|
|||
"monkoose/neocodeium",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local uv = vim.uv
|
||||
local fn = vim.fn
|
||||
local pummenu_timer = assert(uv.new_timer())
|
||||
local cmp = require("cmp")
|
||||
local neocodeium = require("neocodeium")
|
||||
neocodeium.setup()
|
||||
local renderer = require("neocodeium.renderer")
|
||||
local completer = require("neocodeium.completer")
|
||||
local function is_noselect()
|
||||
local completeopt = vim.o.completeopt
|
||||
return completeopt:find("noselect") and -1 or 0
|
||||
end
|
||||
|
||||
local default_selected_compl = is_noselect()
|
||||
local selected_compl = default_selected_compl
|
||||
|
||||
-- if cmp menu_opened then neocodeium clear
|
||||
cmp.event:on("menu_opened", function()
|
||||
neocodeium.clear()
|
||||
end)
|
||||
neocodeium.setup({
|
||||
filter = function()
|
||||
return not cmp.visible()
|
||||
end,
|
||||
})
|
||||
|
||||
-- if cmp menu_is_closed then neocodeium activate
|
||||
cmp.event:on("menu_closed", function()
|
||||
local cur_selected = fn.complete_info({ "selected" }).selected
|
||||
if selected_compl == cur_selected then
|
||||
completer:initiate()
|
||||
else
|
||||
selected_compl = cur_selected
|
||||
completer:clear(true)
|
||||
renderer:display_label()
|
||||
pummenu_timer:stop()
|
||||
pummenu_timer:start(
|
||||
400,
|
||||
0,
|
||||
vim.schedule_wrap(function()
|
||||
if fn.pumvisible() == 1 then
|
||||
completer:initiate()
|
||||
end
|
||||
end)
|
||||
)
|
||||
end
|
||||
end)
|
||||
vim.keymap.set("i", "<C-g>", function()
|
||||
neocodeium.accept()
|
||||
end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue