Reputation: 110093
Is it possible to change the language that is detected in a vim
file? For example, in TextMate, there is a language dropdown so that you can, for example, change a file from one language to another:
Also, sometimes I will have a json object in a python file, or some javascript in html, etc. I don't exact it to be able to mark-up each section properly, though it would be nice to be able to change the language-detected-formatted accordingly. Is this possible in vim?
Upvotes: 0
Views: 111
Reputation: 2857
Is it possible to change the language that is detected in a vim file? For example, in TextMate, there is a language dropdown so that you can, for example, change a file from one language to another:
Yes, it is! You can manually change the filetype (language) of files by setting the filetype
option:
:set filetype=html
More information is available in the documentation.
Also, sometimes I will have a json object in a python file, or some javascript in html, etc. I don't exact it to be able to mark-up each section properly, though it would be nice to be able to change the language-detected-formatted accordingly. Is this possible in vim?
I have not tried this myself, but there are some solutions in the Vim Tips Wiki: Different syntax highlighting within regions of a file
Upvotes: 1