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

Recent update (on command-lazyloading) screws up vim-floaterm

Open Bekaboo opened this issue 1 year ago • 7 comments

  • nvim --version: 0.8.1
  • git --version: 2.38.1
  • Operating system/version: Linux, kernel 6.0.11-arch1-1
  • Terminal name/version: kitty 0.26.5

Steps to reproduce

  1. Use packer to install vim-floaterm with lazyloading:
use {
  'voldikss/vim-floaterm',
  cmd = {
    'FloatermNew',
    'FloatermToggle'
  },
}
  1. Enter nvim
  2. Type in commandline: FloatermNew
  3. Hit space
  4. Floaterm opens a new terminal with error right after we hit space

Actual behaviour

See above.

Expected behaviour

Floaterm should not open a new terminal before we hit <Enter>. The problem is command-lazyloading: if I do not lazy load Floaterm, or use key-lazyloading, the problem will not appear.

Bekaboo avatar Dec 11 '22 08:12 Bekaboo

I can't reproduce this. Is it still an issue? What packer commit are you on?

wbthomason avatar Dec 13 '22 15:12 wbthomason

I can't reproduce this. Is it still an issue? What packer commit are you on?

Hi! Thank you for your reply, I also find that with minimal config i.e. single init.lua that only calls packer.startup and registers packer and vim-floaterm does not have this issue. I'm trying to figuring out the real reason. I'll close this if the issue is related to packer. Sorry for the inconvenience.

Bekaboo avatar Dec 14 '22 04:12 Bekaboo

It turns out nvim-cmp is the cause of the problem (don't know why). Close this issue.

Bekaboo avatar Dec 14 '22 05:12 Bekaboo

For anyone interested about the bug, the minimal config is:

vim.cmd('packadd packer.nvim')
require('packer').startup({
  function(use)
    use({ 'wbthomason/packer.nvim' })
    use({
      'voldikss/vim-floaterm',
      cmd = { 'FloatermNew', 'FloatermToggle' },
    })
    use({
      'hrsh7th/nvim-cmp',
      config = function()
        local cmp = require('cmp')
        cmp.setup()
        cmp.setup.cmdline(':', {
          enabled = true,
          sources = {
            { name = 'cmdline' },
          }
        })
      end,
    })
    use({
      'hrsh7th/cmp-cmdline',
      requires = 'nvim-cmp',
    })
  end,
})

save it as init_test.lua and use nvim -u init_test.lua to start nvim.

Bekaboo avatar Dec 14 '22 05:12 Bekaboo

Reopen this issue because I find starting from commit ed2d5c9c17f4df2eeaca4878145fecc9669e0138 the problem arises. Before this commit packer uses file as the complete option for nvim_create_user_command(); after this commit packer uses a custom function to get the completion list. While this brings a better completion experience, it also introduces the bug mentioned in the issue.

@wbthomason

Bekaboo avatar Dec 14 '22 06:12 Bekaboo

A short video demonstrating the bug:

https://user-images.githubusercontent.com/76579810/207523205-bd5db373-0769-4d8a-a33c-4f5016822f58.mp4

Bekaboo avatar Dec 14 '22 06:12 Bekaboo

Also see the issue under nvim-cmp: https://github.com/hrsh7th/nvim-cmp/issues/1348

Bekaboo avatar Dec 14 '22 07:12 Bekaboo