nvim-cmp icon indicating copy to clipboard operation
nvim-cmp copied to clipboard

require'cmp' returns boolean

Open anuark opened this issue 3 years ago • 1 comments

FAQ

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

Announcement

Minimal reproducible full config

if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
cmp.setup {
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body)
    end,
  },

  mapping = {
    ['<CR>'] = cmp.mapping.confirm({ select = true })
  },

  sources = {
    { name = "nvim_lsp" },
    { name = "buffer" },
  },
}
EOF

lua << EOF
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())

require'lspconfig'.cssls.setup {
  capabilities = capabilities,
}
EOF

Description

Tried to run the working config file nvim -u cmp-init.vim --noplugin but got the following error:

Error detected while processing /Users/anuarkilgore/code/.dotfiles/cmp-init.vim: line 44: E5108: Error executing lua [string ":lua"]:2: attempt to index local 'cmp' (a boolean value) stack traceback: [string ":lua"]:2: in main chunk Press ENTER or type command to continue

I'm using a stable version of nvim v0.7.2 on a M1 Macbook pro

Steps to reproduce

nvim -u cmp-init.vim

Expected behavior

I think it should return an address value instead like the other extensions.

Actual behavior

returns a boolean value

Additional context

Haven't found any other issues related to this one.

anuark avatar Jul 05 '22 00:07 anuark

Tested on a Ubuntu docker container and seems to work fine but by assigning --platform=linux/amd64

docker run --platform=linux/amd64 -it ubuntu
nvim -u cmp-init.vim

So would could this issue be because of arm64 architecture of the M1 macbook?

anuark avatar Jul 11 '22 22:07 anuark

@anuark ~~i certainly have this problem with the M1, is there a workaround?~~

nvm, was hitting this: https://github.com/hrsh7th/nvim-cmp/issues/1063#issuecomment-1259858180

keponk avatar Oct 15 '22 21:10 keponk