spadgos / sublime-DefaultFileType

ST2 Package which automatically sets the syntax for new files
MIT License
68 stars 20 forks source link

Doesn't working with files without an extension (like Gemfile) #2

Closed mariozaizar closed 12 years ago

mariozaizar commented 12 years ago

Hi, I think that there is an issue with the plugin, since I already changed to use ruby as the default syntax for those files. But it keeps opening as plain text.

spadgos commented 12 years ago

I'm not seeing this myself. For example, I have a file without extension which I have set to Javascript syntax. Pressing Ctrl+N opens a new file with Javascript highlighting.

The plugin only works by overwriting the Ctrl+N keyboard shortcut (using the menu to open a new file won't trigger the plugin). Can you make sure that the plugin is actually executing by logging the commands (sublime.log_commands(1) in the console)

mariozaizar commented 12 years ago

Oh, I see what is the problem then.

I was misunderstanding the plugin. You're correct, using command + N after setting-up the sintaxis, all the new files will have the correct pattern. But, the thing is that I was expecting that previous files will be opened with the correct sintaxis as well.

For example, I open Gemfile and set the default sintaxis for Ruby and close it, open again with command+P and the file is being rendered as plain text again. I won't create a new Gemfile, since there is only one per project..

Maybe we could override the command+P also?

spadgos commented 12 years ago

For files which have extensions, you can set the default syntax by the syntax selection menu. For other ones, I believe there are other plugins which do this. I couldn't tell you what they're called, sorry, but if you look through the Package Control plugins, there should be something there.