Why does the vim java syntax only run on the first java buffer?

585    Asked by MariaHodges in Java , Asked on Oct 11, 2022

 I'm using neovim v0.4.4, vim-plug, and uiiaoo/java-syntax.vim.

For some unknown reason(s), syntax highlighting from java-syntax only works on the 1st java buffer. For example:

$ nvim file1.java :e file2.java

$ nvim notJava.txt :vs file1.java :sp file2.java

In both cases, only file1.java has syntax highlighting from java-syntax, while file2 doesn't.

My init.vim

filetype on filetype plugin on syntax on " In vim-plug Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'uiiaoo/java-syntax.vim', {'for': 'java'} " For coc.vim let g:coc_global_extensions = [ 'coc-java', 'coc-highlight', ]

I don't see anything here that would interfere with java-syntax. What might be the cause for only the first Java buffer getting the syntax highlighting?

Answered by MARIA ISABEL

Regarding the vim java, I've found that disabling sheerun/vim-polyglot solved the problem. I'm not sure why exactly polyglot was causing it, but seeing as Java isn't supported by polyglot, I disabled it by putting the following line before polyglot was loaded.

let g:polyglot_disabled = ['java']

For reference, here's my plugin portion (I'm using vim-plug)

call plug#begin('$HOME/.config/nvim/plugged') " Some other plugins let g:polyglot_disabled = ['java'] Plug 'sheerun/vim-polyglot' call plug#end()



Your Answer

Interviews

Parent Categories