diff --git a/lazy-lock.json b/lazy-lock.json index c15bc6c..5b64267 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -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" }, diff --git a/lua/custom/default.lua b/lua/custom/default.lua index 43c2f10..4ea817f 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -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 diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 1fcc559..9931037 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -3,116 +3,118 @@ 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 -return { - { "hrsh7th/cmp-nvim-lsp", event = "InsertEnter", lazy = true }, - { "hrsh7th/cmp-buffer", event = "InsertEnter", lazy = true }, - { "hrsh7th/cmp-path", event = "InsertEnter", lazy = true }, - { "saadparwaiz1/cmp_luasnip", event = "InsertEnter", lazy = true }, - { "hrsh7th/cmp-nvim-lua", event = "InsertEnter", lazy = true }, - { "lukas-reineke/cmp-rg", lazy = true, enabled = cmprg }, -- experimental - { "hrsh7th/cmp-calc", lazy = true, enabled = cmpcalc }, -- experimental - { "quangnguyen30192/cmp-nvim-tags", lazy = true, enabled = cmptag }, -- experimental - { - "hrsh7th/nvim-cmp", - lazy = true, - version = false, -- last release is way too old - event = "InsertEnter", - opts = function() - 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") - end - - return { - completion = { - completeopt = "menu,menuone,noinsert", - }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif check_backspace() then - fallback() - else - fallback() - end - end, { - "i", - "s", - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { - "i", - "s", - }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - { name = "nvim_lua" }, - { name = "rg" }, -- experimental - { name = "calc" }, -- experimental - { name = "tags" }, --experimental - }), - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - vim_item.kind = string.format("%s", require("user.icons")["kind"][vim_item.kind]) - vim_item.menu = ({ - nvim_lsp = "(LSP)", - luasnip = "(Snippet)", - buffer = "(Buffer)", - path = "(Path)", - })[entry.source.name] - return vim_item - end, - }, - window = { - -- completion = cmp.config.window.bordered(), - -- documentation = cmp.config.window.bordered(), - -- remove border window from cmp - completion = { - border = icons.Border, - 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, - }, - }, - experimental = { - ghost_text = lspghost_text, - native_menu = false, - }, - } - end, - }, +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 }, + { "hrsh7th/cmp-path", event = "InsertEnter", lazy = true }, + { "saadparwaiz1/cmp_luasnip", event = "InsertEnter", lazy = true }, + { "hrsh7th/cmp-nvim-lua", event = "InsertEnter", lazy = true }, + { "lukas-reineke/cmp-rg", lazy = true, enabled = cmprg }, -- experimental + { "hrsh7th/cmp-calc", lazy = true, enabled = cmpcalc }, -- experimental + { "quangnguyen30192/cmp-nvim-tags", lazy = true, enabled = cmptag }, -- experimental + { + "hrsh7th/nvim-cmp", + lazy = true, + version = false, -- last release is way too old + event = "InsertEnter", + opts = function() + 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" + end + + return { + completion = { + completeopt = "menu,menuone,noinsert", + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }, + sources = cmp.config.sources { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + { name = "nvim_lua" }, + { name = "rg" }, -- experimental + { name = "calc" }, -- experimental + { name = "tags" }, --experimental + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + vim_item.kind = string.format("%s", require("user.icons")["kind"][vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = "(LSP)", + luasnip = "(Snippet)", + buffer = "(Buffer)", + path = "(Path)", + })[entry.source.name] + return vim_item + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + -- remove border window from cmp + completion = { + 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, + native_menu = false, + }, + } + end, + }, }