I’d like to make any file which begins with #!/usr/bin/env node be recognized as JavaScript.
I know Vim does this with other languages, like BASH, so there must be a way of doing it.
Thank you!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Add the following code snippet to your .vimrc or to another file
and source it in .vimrc:
This simply sets the filetype to js when the first line of the
file matches ‘#!/usr/bin/env node’ – pretty much self explanatory.
This is described in the filetype help as well – check :he filetype