I would like to extend my JS syntax highlighting with highlight certain functions that will be commonly used in my program. I am using janus to keep all my plugins in order. Right now I have a file in there called vim-chino and then in there I have a syntax folder and a ftdetect folder. In both I have a chino.vim file. This is my syntax/chino.vim file:
if !exists("main_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let main_syntax = 'javascript'
endif
syn match chinoKeywords "ChinoView"
hi def link chinoKeywords Function
let b:current_syntax = "javascript"
if main_syntax == 'javascript'
unlet main_syntax
endif
and in my ftdetect/chino.vim I have:
function! s:DetectJS()
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
setfiletype javascript
endif
endfunction
autocmd BufNewFile,BufRead * call s:DetectJS()
I would like it to highlight ChinoView in any javascript file. I feel like the syntax highlighting for JS is either overriding it or it this is not being read.
EDIT: If I had to guess where something was happening was that when it looks at b:current_syntax it already has a syntax so it quits.
:syn list chinoKeywordsoutputs anything. If it doesn't it means that your syn match isn't taking effect.No such highlight group name: chinoKeywords. I have also triedsyn keyword chinoKeywords ChinoViewbut that doesn't work either.syn match chinoKeywords "ChinoView"andhi def link chinoKeywords Functiontos:DetectJS()instead of yoursyntax/chino.vim. (after thesetfiletype javascript)