Update
I've managed to get the top part of the file fixed with syn region pugJavascriptLine start=/^\s*-/ end=/$/ contains=@htmlJavascript
from this programmer: https://github.com/digitaltoad/vim-pug/issues/98#issuecomment-296461439
But the template strings still don't recognize their contents as JavaScript:
Perhaps there's another line I could add to the pug syntax file that would let it know how template strings work. The file is here: https://github.com/digitaltoad/vim-pug/blob/master/syntax/pug.vim
Anyone with better Regex skills than me out there?
Update end
I'm using neovim for lots of web dev, and I'm having trouble with pug syntax highlighting.
I can't seem to get it to display JavaScript in the pug files (which it was doing just fine before I switched to a new Thinkpad).
The JS is just in plain white text. Here's my vimrc: https://gist.github.com/wamoyo/34405c4672c89dbfded62ea34134003b
And I haven't edited the pug.vim file or anything like that. But I have messed around a bit with the xoria256.vim colorscheme file, adding this to the bottom:
" hi jsBooleanTrue ctermfg=41
" hi jsBooleanFalse ctermfg=174
" hi jsString ctermfg=229
" hi jsComment ctermfg=244
hi jsGlobalObjects ctermfg=256
hi jsGlobalNodeObjects ctermfg=256
" hi jsExceptions ctermfg=256
" hi jsThis ctermfg=256
" hi jsPrototype ctermfg=256
" hi jsHtmlEvents ctermfg=256
" hi jsDecorator ctermfg=146
" hi jsSpecial ctermfg=180
" hi jsFloat ctermfg=180
" hi jsNan ctermfg=180
" hi jsTemplateVar ctermfg=251
" hi jsTemplateBraces ctermfg=146
" hi jsDecoratorFunction ctermfg=182
" hi jsRegexpString ctermfg=180
" hi jsRegexpBoundary ctermfg=180
" hi jsRegexpQuantifier ctermfg=180
" hi jsRegexpOr ctermfg=180
" hi jsRegexpMod ctermfg=180
" hi jsRegexpBackRef ctermfg=180
" hi jsRegexpGroup ctermfg=180
" hi jsRegexpCharClass ctermfg=180
On the old laptop, I didn't have any of those commented out, but the new laptop seems to support more colors in the gnome terminal.
This line from pug.vim
seems relevant:
syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
Lines 6-16 above are using the syntax group pugTagInlineText
.
Actually, I know it's not those edits in the xoria256.vim file, because I have the same issue with other colorschemes.
I'm also happy to switch colorschemes if there's one that handles html5, css, and ES6 really nicely.