aboutsummaryrefslogtreecommitdiffstats
path: root/lua/pi/completition/init.lua
diff options
context:
space:
mode:
authorElvis Claros Castro <elvis@claros.ar>2024-09-20 23:08:00 -0300
committerElvis Claros Castro <elvis@claros.ar>2024-09-20 23:08:00 -0300
commitfa3e94e60b9edc7c3620f43e207b915eae84bab0 (patch)
tree10617c9508c797ffb9bcf3bdb09c60ae69371662 /lua/pi/completition/init.lua
parent6364400a98c93cdf6f2209670be1d2b6e31ee6ab (diff)
downloadnvim-conf-fa3e94e60b9edc7c3620f43e207b915eae84bab0.tar.gz
nvim-conf-fa3e94e60b9edc7c3620f43e207b915eae84bab0.zip
feat: solo dejo phpactor
Diffstat (limited to 'lua/pi/completition/init.lua')
-rw-r--r--lua/pi/completition/init.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/lua/pi/completition/init.lua b/lua/pi/completition/init.lua
index 5b9fd18..418c6d2 100644
--- a/lua/pi/completition/init.lua
+++ b/lua/pi/completition/init.lua
@@ -55,14 +55,14 @@ cmp.setup {
["<c-space>"] = cmp.mapping.complete(),
},
sources = {
- -- { name = "dictionary", keyword_length = 2},
+ { name = "dictionary", keyword_length = 2},
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "luasnip" },
{ name = "copilot" },
{name = "codeium"},
- { name = 'cmp_ai' },
+ -- { name = 'cmp_ai' },
{ name = 'html-css',
option = {
max_count = {}, -- not ready yet
@@ -86,7 +86,8 @@ cmp.setup {
local bufs = {}
for _, win in ipairs(vim.api.nvim_list_wins()) do
local bufnr = vim.api.nvim_win_get_buf(win)
- if vim.api.nvim_buf_get_option(bufnr, "buftype") ~= "terminal" then
+ local buftype = vim.api.nvim_get_option_value("buftype", { buf = bufnr })
+ if buftype ~= "terminal" then
bufs[bufnr] = true
end
end
@@ -163,6 +164,17 @@ cmp.setup {
end
vim_item.kind = KIND_ICONS[vim_item.kind] or vim_item.kind
+ -- Add maxwidth and ellipsis_char in the middle
+ local maxwidth = 20
+ local ellipsis_char = '...'
+ if #vim_item.abbr > maxwidth then
+ local half_width = math.floor((maxwidth - #ellipsis_char) / 2)
+ vim_item.abbr = string.sub(
+ vim_item.abbr,
+ 1,
+ half_width
+ ) .. ellipsis_char .. string.sub(vim_item.abbr, -half_width)
+ end
return vim_item
end
},