finally a less distracting cmp

I was getting frustrated with nvim-cmp as the default setup for it in NvChad is to annoyingly pop crap up all the time as I type. I was hoping to set it to only do it when the tab key is pressed or something, but I’m going to settle for *Control+Backslash

I’m sure there’s a way to do this from the init.lua instead of editing NvChad core stuff, but I’m still new to it and this is how I accomplished it.

I edited .config/nvim/lua/plugins/config/cmp.lua and added autocomplete=false, in the options block, so the top of that block now looks like this:

local options = {
  completion = {
    completeopt = "menu,menuone",
    autocomplete = false, -- < -- this is the important line
  },
    -- and more default stuff after that...
}

Then I found the mapping for Control+Space and changed it to Control+Backslash because Control+Space is how I trigger the IME.

  mapping = {
    ["<C-p>"] = cmp.mapping.select_prev_item(),
    ["<C-n>"] = cmp.mapping.select_next_item(),
    ["<C-d>"] = cmp.mapping.scroll_docs(-4),
    ["<C-f>"] = cmp.mapping.scroll_docs(4),
    ["<C-\\>"] = cmp.mapping.complete(), -- <-- it's this one
    ["<C-e>"] = cmp.mapping.close(),
    ["<CR>"] = cmp.mapping.confirm {
      behavior = cmp.ConfirmBehavior.Insert,
      select = true,
    },
    -- and more default stuff after that...
  }

Tags

#index

#nvim

#cli

Navigation

index

tags

prev ⏰

⏰ next

updated: 2023-09-30 10:15:01

generated: 2024-05-25