David542
David542

Reputation: 110093

Change the markup/detected-language of a file

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:

enter image description here

enter image description here

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

Answers (1)

runar
runar

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

Related Questions