kevinoid/vim-jsonc

Error opening a .jsonc file

Closed this issue · 5 comments

Error detected while processing function <SNR>3_LoadFTPlugin:
line    2:
E492: Not an editor command: commentstring< comments<

The error goes away if I comment out the loading of the plugin in my /etc/xdg/nvim/sysinit.vim:

" Plug 'kevinoid/vim-jsonc'

Thanks for reporting the issue. Unfortunately, I'm unable to reproduce it. What version of Neovim are you using? Can you reproduce the issue without vim-plug?

What version of Neovim are you using?

$ nvim --version
NVIM v0.4.4
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-eK2ojg/neovim-0.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=1 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim-eK2ojg/neovim-0.4.4/build/config -I/build/neovim-eK2ojg/neovim-0.4.4/src -I/usr/include -I/usr/include/lua5.1 -I/build/neovim-eK2ojg/neovim-0.4.4/build/src/nvim/auto -I/build/neovim-eK2ojg/neovim-0.4.4/build/include
Compiled by team+vim@tracker.debian.org

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Can you reproduce the issue without vim-plug?

I haven't tried without vim-plug because I find it very cumbersome to manage plugins without it. I did reduce my /etc/xdg/nvim/sysinit.vim to the minimum and it still happens:

" vim-plug
" From https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
" Automatic installation
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
  silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  " ~/.cache grows really big
  silent !rm -rf ~/.cache
  autocmd VimEnter * UpdateRemotePlugins
endif
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')
" Declare the list of plugins.
Plug 'kevinoid/vim-jsonc'
call plug#end()

I'm able to edit other (non json) files without a problem.

I'm seeing the same issue using vim-plug on nvim v0.4.4.

Same here.

❯ nvim --version
NVIM v0.5.0-dev+4d1fc167a
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210126-11253-b8ucul/build/config -I/tmp/neovim-20210126-11253-b8ucul/src -I/usr/local/include -I/tmp/neovim-20210126-11253-b8ucul/deps-build/include -I/opt/local/include -I/tmp/neovim-20210126-11253-b8ucul/build/src/nvim/auto -I/tmp/neovim-20210126-11253-b8ucul/build/include
Compiled by yanzhang@mbp

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-4d1fc16/share/nvim"

Run :checkhealth for more info

@gasull @djvolz , I found an alternative (https://github.com/neoclide/jsonc.vim) and it works well.
Thanks.

To Reproduce

  • Run vim --clean minimal.jsonc with
// minimal.jsonc
{
  "foo": "bar"
}
  • Run command :setfiletype jsonc