add: config for disable cmp doc

This commit is contained in:
asep.komarudin 2024-06-02 19:31:26 +07:00
parent 72ff763f68
commit 4bbbf4bc75
3 changed files with 118 additions and 114 deletions

View file

@ -38,9 +38,9 @@
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" },
"nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" },
"nvim-treesitter": { "branch": "master", "commit": "979beffc1a86e7ba19bd6535c0370d8e1aaaad3c" },
"nvim-treesitter": { "branch": "master", "commit": "a80fe081b4c5890980561e0de2458f64aaffbfc7" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "fd41b7ccc5490a3a99c734d1ee418b68d06c48a9" },
"nvim-ts-autotag": { "branch": "main", "commit": "bcf3146864262ef2d3c877beba3e222b5c73780d" },
"nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },

View file

@ -118,3 +118,5 @@ vim.g.pcode_codeium = true
vim.g.pcode_nvimufo = true
vim.g.pcode_indentscope = true
vim.g.pvode_minianimate = true
vim.g.pcode_disable_cmpdoc = false

View file

@ -3,6 +3,12 @@ local cmpcalc = vim.g.pcode_cmpcalc or false
local cmptag = vim.g.pcode_cmptag or false
local lspghost_text = vim.g.pcode_lspghost_text or false
local icons = require("user.icons").ui
local cmp_documentation = {
border = icons.Border,
winhighlight = "Normal:bg,FloatBorder:BorderBG,CursorLine:PmenuSel,Search:None",
scrollbar = true,
}
return {
{ "hrsh7th/cmp-nvim-lsp", event = "InsertEnter", lazy = true },
{ "hrsh7th/cmp-buffer", event = "InsertEnter", lazy = true },
@ -18,12 +24,12 @@ return {
version = false, -- last release is way too old
event = "InsertEnter",
opts = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local cmp = require "cmp"
local luasnip = require "luasnip"
local check_backspace = function()
local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
local col = vim.fn.col "." - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
end
return {
@ -35,12 +41,12 @@ return {
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
mapping = cmp.mapping.preset.insert {
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
@ -69,8 +75,8 @@ return {
"i",
"s",
}),
}),
sources = cmp.config.sources({
},
sources = cmp.config.sources {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
@ -79,7 +85,7 @@ return {
{ name = "rg" }, -- experimental
{ name = "calc" }, -- experimental
{ name = "tags" }, --experimental
}),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
@ -102,11 +108,7 @@ return {
winhighlight = "Normal:bg,FloatBorder:BorderBG,CursorLine:PmenuSel,Search:None",
scrollbar = true,
},
documentation = {
border = icons.Border,
winhighlight = "Normal:bg,FloatBorder:BorderBG,CursorLine:PmenuSel,Search:None",
scrollbar = true,
},
documentation = vim.g.pcode_disable_cmpdoc and cmp.config.disable or cmp_documentation,
},
experimental = {
ghost_text = lspghost_text,