Couple of days back i came to know about JavaScript code modules. Such files have an extension of .jsm and are not highlighted in Vim by default. Running the command
set filetype=javascript everytime is not the best way to do things.
So, now we just need to check if the file extension is .jsm and then run the set filetype command.
Adding the following lines to ~/.vimrc should do the trick
au BufNewFile,BufRead *.jsm set filetype=javascript
Note: that we should have the following lines in our .vimrc file
syntax on
filetype on
If you want to know more about au,BufNewFile,BufRead type :help [command] in your vim and that should give all that’s required.