junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.89k stars 1.9k forks source link

Unexpected symbol near ' , ' #1210

Closed MateoElias closed 1 year ago

MateoElias commented 1 year ago

Every time I try to install a plugin with a { 'do:' } function or { 'branch' }, I always get the error `Unexpected symbol near ' , ' (Being the comma to separate the "Plug" command)

vim.call('plug#begin', '~/.config/nvim/plugged')
--      PLUGINS

--  OneDark theme
Plug 'navarasu/onedark.nvim'

--  NVim Tree
Plug 'kyazdani42/nvim-web-devicons' --  Optional Icons
Plug 'kyazdani42/nvim-tree.lua'

--  CoC
Plug 'neoclide/coc.nvim', {'branch': 'release'}

vim.call('plug#end')
NVIM v0.7.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compiled by root@lcy02-amd64-012

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"
Superar commented 1 year ago

You can circumvent this problem by wrapping the plug# directive as such:

local Plug = vim.fn['plug#']

Then you can call it as such

Plug('neoclide/coc.vim', {['branch'] = release'})

So your file should be

local Plug = vim.fn['plug#']

vim.call('plug#begin', '~/.config/nvim/plugged')
--      PLUGINS

--  OneDark theme
Plug 'navarasu/onedark.nvim'

--  NVim Tree
Plug 'kyazdani42/nvim-web-devicons' --  Optional Icons
Plug 'kyazdani42/nvim-tree.lua'

--  CoC
Plug('neoclide/coc.nvim', {['branch'] = 'release'})

vim.call('plug#end')

This should do the trick! Hope it helps :smile: