Closed mattsawyer77 closed 6 years ago
@andre-simon ah, OK. well, it seems that javascript files are only identifiable via shebang but not via file extension. What is the best way to fix this problem?
.js is automatically mapped to js.lang. If a new language like Z should be supported, it is sufficient to create a file called z.lang in the langDefs directory. If Z has more extensions, like .zinc, then zinc needs to be listed in filetypes.conf.
If js is not highlighted correctly, please run highlight -Sjs --verbose
and look for the loaded file after Loading language definition:
This was a simple error on my part. I was piping a javascript file to highlight, expecting it to detect the file type for some reason. If I run the command passing in a filename, it works fine. Sorry for the noise.
You can use the -s option to define the syntax. This also overrides extension and shebang recognition.
The lang files are called js.lang and json.lang, so these extensions are not required in filetypes.conf. A mapping to javascript would not work as intended, as there is no lang file with this name.