How to get Sublime Text 3 to automatically highlight CSHTML as HTML

6

I have a bunch of .CSHTML files that I want to be highlighted. Every time I open a .CSHTML file I have to go to the bottom right of the sublime text window and manually tell it to treat the CSHTML as HTML. How do I force SB3 to automatically do this?

toshiomagic

Posted 2017-04-10T18:14:32.420

Reputation: 163

Answers

9

  1. Open any .cshtml file
  2. In the main-menu, choose View > Syntax > Open all with current extension as… and select HTML

idleberg

Posted 2017-04-10T18:14:32.420

Reputation: 1 200

1Why couldn't I find any tutorial online that just said that?? They all wanted me to open my HTML.sublime-settings. Thanks! – toshiomagic – 2017-04-11T13:37:48.250

Well this is only applying HTML formatting - none of the Razor syntax is highlighted - so it's at best a 50% solution. – niico – 2018-09-20T11:03:50.110