supermaven-inc / supermaven-nvim

The official Neovim plugin for Supermaven
https://supermaven.com/
MIT License
584 stars 29 forks source link

Supermaven still uses Tab after disabling inline completion in Neovim #77

Open Wervice opened 2 months ago

Wervice commented 2 months ago

I am using Supermaven with Neovim and have configured it to use CMP for completion like this:

require("supermaven-nvim").setup({
  color = {
    suggestion_color = "#f38ba8",
    cterm = 244,
  },
  log_level = "off", -- set to "off" to disable logging completely
  disable_inline_completion = true, -- disables inline completion for use with cmp
  disable_keymaps = true -- disables built in keymaps for more manual control
})

The completion shows up in CMP, but pressing Tab still completes my input. This makes my code editor unusable as I am forced to press the arrow back key so I can indent.

AlejandroSuero commented 2 weeks ago

@Wervice do you have cmp configured in the way that it accepts the first item that appears and you accept cmp items with <Tab>?

Wervice commented 2 weeks ago

No, I have configured cmp to auto-select the first item that appears but I need to press enter/return for it to be selected. When having cmp open, I can use tab to select another recommendation. The goal for me is that I get the supemaven recommendation as the first cmp results, can confirm it with return but pressing tab outside cmp works as usual. Supermaven still takes tab presses outside cmp as confirmations. Thank you for your response 🙂

AlejandroSuero commented 2 weeks ago

@Wervice I'll see tomorrow what I can do, I don't have my pc around to test it out

AlejandroSuero commented 2 weeks ago

https://github.com/user-attachments/assets/928fc846-bfd3-4eba-a30a-75a2c8799b3d

@Wervice here is not completing with supermaven and cmp letting me use <Tab> as much as I want.

--- cmp config
  config = function()
    vim.opt.completeopt = "menu,menuone,noselect"
    vim.opt.shortmess:append "c"

    local lspkind = require "lspkind"
    lspkind.init {}

    local cmp = require "cmp"

    local luasnip = require "luasnip"

    cmp.setup({
      sources = {
        { name = "lazydev", group_index = 0 },
        { name = "supermaven" },
        { name = "nvim_lsp" },
        { name = "path" },
        { name = "buffer" }, -- text within current buffer
      },
      snippet = { -- configure how nvim-cmp interacts with snippet engine
        expand = function(args)
          luasnip.lsp_expand(args.body)
        end,
      },
      mapping = {
        ["<C-p>"] = cmp.mapping.select_prev_item {
          behavior = cmp.SelectBehavior.Select,
        }, -- previous suggestion
        ["<C-n>"] = cmp.mapping.select_next_item {
          behavior = cmp.SelectBehavior.Select,
        }, -- next suggestion
        ["<C-y>"] = cmp.mapping(
          cmp.mapping.confirm {
            behavior = cmp.ConfirmBehavior.Insert,
            select = true,
          },
          { "i", "c" }
        ),
      },
    })

    vim.api.nvim_set_hl(0, "CmpItemKindSupermaven", { fg = "#44bdff" })
  end,
-- supermaven config
config = function()
  require("supermaven-nvim").setup({
    color = {
      suggestion_color = "#f38ba8",
      cterm = 244,
    },
    log_level = "off", -- set to "off" to
    disable_inline_completion = true, -- 
    disable_keymaps = true, -- disables b
  })
end,