Changing default syntax based on filename

后端 未结 2 1280
北荒
北荒 2020-12-24 01:06

In Sublime Text 2, I\'ve seen ways of basing the syntax off of the extension. But what about a filename with no extension? For example, I often have a file called \"Vagrantf

相关标签:
2条回答
  • 2020-12-24 01:17

    Add the following line to the Syntax Specific - User file in

    Preferences > Setting - More > Syntax Specific - User

    for permanent staying of the syntax for every Vagrantfile file.


    {
        "extensions":
        [
            "Vagrantfile"
        ]
    }
    
    0 讨论(0)
  • With Sublime Text 2.0.1, build 2217, look in the lower right of the window, where it says "Plain Text" for the Vagrantfile that is open.

    enter image description here

    Click that and in the menu that opens, at the top, there will be an "Open all with current extension as ..." sub-menu. Go into that sub-menu and choose Ruby.

    Even though the Vagrantfile has no extension, Sublime will remember this and open Vagrantfiles with the Ruby syntax as expected. This does not spread to all files with no extension.

    0 讨论(0)
提交回复
热议问题