Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot select next entry without cmp anymore #1147

Closed
2 tasks done
AckslD opened this issue Aug 22, 2022 · 3 comments
Closed
2 tasks done

Cannot select next entry without cmp anymore #1147

AckslD opened this issue Aug 22, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@AckslD
Copy link

AckslD commented Aug 22, 2022

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Announcement

Minimal reproducible full config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]

local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup{
    {
      'wbthomason/packer.nvim',
      'hrsh7th/nvim-cmp',
      'hrsh7th/cmp-nvim-lsp',
      'onsails/lspkind-nvim',
    },
    config = {
      auto_clean = false,
      package_root = package_root,
      compile_path = package_root .. '/packer/start/packer_compiled/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  local cmp = require('cmp')
  cmp.setup {
    mapping = cmp.mapping.preset.insert({
      ['<CR>'] = cmp.config.disable,
      ['<C-u>'] = cmp.mapping.scroll_docs(4),
      ['<C-e>'] = cmp.mapping.close(),
      ['<C-k>'] = function(fallback)
        if cmp.visible() then
          cmp.mapping.confirm({ select = true })(fallback)
        else
          cmp.mapping.complete()(fallback)
        end
      end
    }),
    sources = {
      { name = "nvim_lsp"},
    },
    snippet = {
      expand = function(args)
        require("luasnip").lsp_expand(args.body)
      end,
    },
    formatting = {
      format = require('lspkind').cmp_format {
        with_text = true,
        menu = {
          nvim_lua = "[Lua]",
          nvim_lsp = "[LSP]",
          luasnip = "[LuaSnip]",
          cmp_git = "[Git]",
        },
      },
    },
    completion = {
      autocomplete = false,
    },
    experimental = {
      ghost_text = {
        hl_group = 'Nontext',
      },
    },
  }
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing dependencies.")
  print(vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path })
  if vim.v.shell_error ~= 0 then
    return
  end
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]

Description

I don't use cmp for eg normal built-in buffer completion. After updating my plugins today it seems like I cannot anymore select the next entry with <C-n> with normal completion.

Steps to reproduce

Open nvim with the above minimal config and type eg co<C-n> in insert mode. The menu opens up but one cannot select the next entry with <C-n>.

Expected behavior

Be able to select the next entry

Actual behavior

Cannot select the next entry

Additional context

I also tried to disable <C-n> or call the fallback etc but couldn't make it work.

@AckslD AckslD added the bug Something isn't working label Aug 22, 2022
@AckslD
Copy link
Author

AckslD commented Aug 23, 2022

After trying to investigate a bit more, this is what I found:

  • If I disable <C-n> with:
    ['<C-n>'] = cmp.config.disable,
    
    and clear the TextChangedP autocmd from cmp with:
    :autocmd! ___cmp___ TextChangedP
    
    then I can do normal buffer completion with <C-n> again. But then selecting the next item in the cmp completion
    menu does not work anymore.
  • If I instead map <C-n> to cmp.mapping.select_next_item, and still remove the TextChangedP then again I cannot do normal completion.
  • After doing some binary search with git reset, the issue seems to occur with commit db261b4 since it works fine with the one before that.

@AckslD
Copy link
Author

AckslD commented Aug 23, 2022

Okay 058100d fixed it again :)

@AckslD
Copy link
Author

AckslD commented Aug 23, 2022

So maybe the same as #1149, closing this since it seems it was fixed

@AckslD AckslD closed this as completed Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant