tokyonight.nvim icon indicating copy to clipboard operation
tokyonight.nvim copied to clipboard

When using nvim-cmp, how do I get this gray box to not appear when scrolling through words?

Open NeckBeardPrince opened this issue 6 months ago • 1 comments

I think it's related to tokyonight, if I change the color scheme to default or others it's transparent.

Here is a video since I'm having a hell of a time putting the issue into words, clearly. I'm a bit new to neovim, so I'm sure I'm overlooking something

NeckBeardPrince avatar Feb 09 '24 14:02 NeckBeardPrince

I don't see that behavior here with nvim-cmp. Parts of the word appearing at the end looks wonky too, so maybe a misconfiguration? Here's my next/prev mapping for nvim-cmp using [Shift] Tab:

Config
local has_words_before = function()
  if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
    return false
  end
  local line, col = unpack(vim.api.nvim_win_get_cursor(0))
  return col ~= 0 and
    vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end

cmp.setup() {
  mapping = {
    ["<Tab>"] = cmp.mapping(function(fallback)
      if cmp.visible() then
        cmp.select_next_item()
      elseif luasnip.expand_or_jumpable() then
        luasnip.expand_or_jump()
      elseif has_words_before() then -- If tabbing after text in insert mode
        cmp.complete() -- Open cmp menu (normally Tab wouldn't trigger this)
      else
        fallback()
      end
    end, { "i", "s" }),
    ["<S-Tab>"] = 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" }),
    ["<Cr>"] = cmp.mapping.confirm()
  },

adrian5 avatar Feb 17 '24 10:02 adrian5

I don't have that

folke avatar Jul 02 '24 13:07 folke