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
|
@ -24,6 +24,7 @@ return {
|
|||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"xzbdmw/colorful-menu.nvim",
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
|
@ -90,13 +91,38 @@ return {
|
|||
format = function(entry, vim_item)
|
||||
vim_item.menu = vim.api.nvim_get_mode().mode == "c" and "" or all_trim(vim_item.kind)
|
||||
vim_item.kind = string.format("%s", all_trim(require("pcode.user.icons")["kind2"][vim_item.kind]))
|
||||
-- vim_item.menu = ({
|
||||
-- nvim_lsp = "(LSP)",
|
||||
-- luasnip = "(Snippet)",
|
||||
-- buffer = "(Buffer)",
|
||||
-- path = "(Path)",
|
||||
-- codeium = "(Codeium)",
|
||||
-- })[entry.source.name]
|
||||
|
||||
local original_notify = vim.notify
|
||||
vim.notify = function(msg, level, opts)
|
||||
if type(msg) == "string" and msg:match("has new line character, please open an issue") then
|
||||
return
|
||||
end
|
||||
original_notify(msg, level, opts)
|
||||
end
|
||||
|
||||
local ok, highlights_info = pcall(require("colorful-menu").cmp_highlights, entry)
|
||||
if ok and highlights_info ~= nil then
|
||||
vim_item.abbr_hl_group = highlights_info.highlights
|
||||
|
||||
-- ambil nama group hilightnya saja
|
||||
-- eg. "@parameter"
|
||||
local var_hilight = highlights_info.highlights[1][1]
|
||||
local id = vim.fn.hlID(var_hilight)
|
||||
|
||||
local var_out = "@tag"
|
||||
-- cek apakah hilight terdefinisi
|
||||
if id ~= 0 then
|
||||
var_out = var_hilight
|
||||
else
|
||||
var_out = var_hilight:match("([^%.]+)")
|
||||
end
|
||||
|
||||
vim_item.menu_hl_group = var_out
|
||||
-- vim.notify(var_out)
|
||||
else
|
||||
vim_item.abbr_hl_group = "CmpItemAbbr"
|
||||
vim_item.menu_hl_group = "CmpItemAbbr"
|
||||
end
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -25,6 +25,7 @@ return {
|
|||
["@tag.css"] = { fg = colors.pink },
|
||||
["@keyword.css"] = { fg = colors.fg },
|
||||
["@string.css"] = { fg = colors.pink },
|
||||
["@punctuation.delimiter.lua"] = { fg = colors.orange },
|
||||
NvimTreeFolderIcon = { fg = "#6776a7" },
|
||||
CmpItemAbbr = { fg = "#ABB2BF" },
|
||||
CmpItemKind = { fg = "#ABB2BF" },
|
||||
|
|
|
@ -52,7 +52,8 @@ return {
|
|||
Color = " ",
|
||||
Control = " ",
|
||||
Collapsed = " > ",
|
||||
Constant = " ",
|
||||
-- Constant = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Copilot = " ",
|
||||
Enum = " ",
|
||||
|
@ -68,7 +69,8 @@ return {
|
|||
-- Keyword = " ",
|
||||
Keyword = " ",
|
||||
Method = " ",
|
||||
Module = " ",
|
||||
-- Module = " ",
|
||||
Module = " ",
|
||||
Namespace = " ",
|
||||
Null = " ",
|
||||
Number = " ",
|
||||
|
@ -78,12 +80,14 @@ return {
|
|||
Property = " ",
|
||||
Reference = " ",
|
||||
-- Snippet = " ",
|
||||
Snippet = " ",
|
||||
-- Snippet = " ",
|
||||
Snippet = " ",
|
||||
String = " ",
|
||||
Struct = " ",
|
||||
TabNine = " ",
|
||||
-- Text = " ",
|
||||
Text = " ",
|
||||
-- Text = " ",
|
||||
Text = " ",
|
||||
TypeParameter = " ",
|
||||
Unit = " ",
|
||||
Value = " ",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue