Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Vim highlight all my JSON comments in red?

I've got some comments in a JSON file that were autogenerated by, and unfortunately it seems like vim can't recognize that they're just comments.

enter image description here

They're all red - which one of my plugins is doing this?

I don't really want to turn all of my syntax highlighting off, and I also don't want to clear the errors manually each time I run into the red highlighting.

" Enable syntax highlighting
syntax enable

" PLUGINS
call plug#begin('~/.vim/plugged')

"   deoplete - code completion
if has('nvim')
"      Add in a syntax file for deoplete typescripe, then add deoplete
    Plug 'HerringtonDarkholme/yats.vim'
    Plug 'mhartington/nvim-typescript', {'do': './install.sh'}
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
    Plug 'Shougo/deoplete.nvim'
    Plug 'roxma/nvim-yarp'
    Plug 'roxma/vim-hug-neovim-rpc'
    Plug 'ternjs/tern_for_vim', { 'do': 'npm install' }
endif

"   fzf - fuzzy find
Plug 'junegunn/fzf', { 'dir': '~/.vim/installed/fzf' }

"   lightline - a nice looking bottom bar
Plug 'itchyny/lightline.vim'
"       also get rid of the useless -- INSERT -- since we have a nice bar
set noshowmode

"   nerdtree - a little tree file browser 
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
"       map it to control-O
map <C-o> :NERDTreeToggle<CR>

"   gitgutter - adds some git context to the left side bar
Plug 'airblade/vim-gitgutter'
set updatetime=100

"   ale - asynchronous linting engine, highlights stuff
Plug 'w0rp/ale'

"   deoplete-ternjs - adds javascript to deoplete
Plug 'carlitux/deoplete-ternjs'
"   tern_for_vim - adds in the tern 'engine' or whatever to vim
Plug 'ternjs/tern_for_vim', { 'do': 'npm install && npm install -g tern' }

"   vimproc - async execution for things
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
"   tsuquyomi - unpronouncable client for TSServer for completion and more
Plug 'Quramy/tsuquyomi', { 'do': 'npm install -g typescript' }

call plug#end()

" CONFIGURE - some of our plugins need configurations so add that in

let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_ignore_case = 1
let g:deoplete#enable_smart_case = 1
let g:deoplete#enable_camel_case = 1
let g:deoplete#enable_refresh_always = 1
let g:deoplete#max_abbr_width = 0
let g:deoplete#max_menu_width = 0
let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{})

let g:tern_request_timeout = 1
let g:tern_request_timeout = 6000
let g:tern#command = ["tern"]
let g:tern#arguments = ["--persistent"]
let g:deoplete#sources#tss#javascript_support = 1
let g:tsuquyomi_javascript_support = 1
let g:tsuquyomi_auto_open = 1
let g:tsuquyomi_disable_quickfix = 1
like image 450
ARMATAV Avatar asked Apr 13 '19 21:04

ARMATAV


People also ask

Why does vim highlight red?

Similarly, errors are generally highlighted in red color and it looks like vim does not know how the syntax should be handled for /etc/sysconfig/named . However, highlighting of error messages is done with the help of Error and ErrorMsg highlight groups. So try to highlight groups as shown below.

What is vim syntax highlighting?

Syntax highlighting enables Vim to show parts of the text in another font or color. Those parts can be specific keywords or text matching a pattern. Vim doesn't parse the whole file (to keep it fast), so the highlighting has its limitations.


1 Answers

As @Michail mentioned, JSON syntax does not support comments, so Vim marks them as error.

like image 93
padawin Avatar answered Sep 28 '22 02:09

padawin