tweak completion a little more

Mon, 27 Feb 2023 13:49:07 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 27 Feb 2023 13:49:07 -0600
changeset 1054
3a0ff0563a7b
parent 1053
bfd0fe75db86
child 1055
ba91fd3b81e1

tweak completion a little more

.config/nvim/lua/plugins/completion.lua file | annotate | diff | comparison | revisions
--- a/.config/nvim/lua/plugins/completion.lua
+++ b/.config/nvim/lua/plugins/completion.lua
@@ -16,8 +16,17 @@ return {
       local cmp = require("cmp")
       return {
         completion = {
+          keyword_length = 3,
           completeopt = "menu,menuone,noinsert,noselect",
         },
+        formatting = {
+          format = function(entry, vim_item)
+            if vim_item.kind == "Text" then
+              vim_item.kind = entry.source.name
+            end
+            return vim_item
+          end,
+        },
         mapping = cmp.mapping.preset.insert({
           ["<C-b>"] = cmp.mapping.scroll_docs(-4),
           ["<C-f>"] = cmp.mapping.scroll_docs(4),
@@ -38,13 +47,11 @@ return {
           { name = "nvim_lsp" },
           { name = "nvim_lsp_signature_help" },
           { name = "nvim_lua" },
-        }, {
-          { name = "calc" },
-          { name = "buffer" },
+          { name = "buffer", option = { keyword_pattern = [[\k\+]] } },
           { name = "path" },
-        }, {
+          { name = "omni" },
           { name = "tags" },
-          { name = "omni" },
+          { name = "calc" },
         }),
       }
     end,

mercurial