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.nvim
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?
for
just in case. The problem was there before addingfor
.:set ft?
tell youfiletype=java
in bothfile1.java
andfile2.java
?java-syntax.vim
looks odd:let b:current_syntax = "java-syntax.vim"
. I believe it should set it to"java"
, which matches the file type... I haven't had time to check whether this can be what causes the issue you're having, but that's where I would have started...sheerun/vim-polyglot
solved the issue. I'll update & answer with furthur details after I've gotpolyglot
to work withjava-syntax
.