Home Download Buy Blog Forum Support

Default syntax mode for files without dot extensions

Default syntax mode for files without dot extensions

Postby Perceptes on Fri Sep 23, 2011 7:18 am

I'd like to set the default syntax to Ruby for files that do not have dot extensions (e.g. Gemfile, Guardfile). It seems the extensions key in Ruby.sublime-settings files only applies to dot extensions. Rakefile defaults to Ruby syntax, and this seems to be defined in Ruby.tmLanguage. Is there a way to add these other filenames in a user-specific settings file so I don't have to modify the core tmLanguage file?

Related question: How would I extend this to other types of path/filename pattern matching? Like, if I wanted foo.rb to default to Ruby but foo_spec.rb to default to RSpec.

Thanks!
Perceptes
 
Posts: 9
Joined: Thu Sep 22, 2011 7:50 pm

Re: Default syntax mode for files without dot extensions

Postby stravid on Fri Sep 23, 2011 9:11 am

i would also love to see a solution for this!
stravid
 
Posts: 7
Joined: Fri Jan 15, 2010 10:27 pm

Re: Default syntax mode for files without dot extensions

Postby slestak989 on Tue Oct 04, 2011 3:46 am

I am also interested in this. Anyone add this to the uservoice site?

I like the idea of a regex on filename or path. I have used similar functionality with vim.
Using ST2 on: Win7 Pro 64 || Win7 32|| Fedora 16
slestak989
 
Posts: 31
Joined: Tue Oct 04, 2011 3:40 am

Re: Default syntax mode for files without dot extensions

Postby jps on Tue Oct 04, 2011 6:03 am

Currently the only way to add an association for extensionless files is directly in the .tmLanguage file
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Default syntax mode for files without dot extensions

Postby ceej on Mon Nov 21, 2011 3:07 pm

This would be a huge feature for rails devs :)
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Default syntax mode for files without dot extensions

Postby slestak989 on Mon Nov 21, 2011 7:46 pm

the SetSyntax plugin will do this. I am patching a fork that will add directory matching. Not sure if I want to do regex, or just list of literal strings.

I am leaning towards literal strings, for simplicity.
Using ST2 on: Win7 Pro 64 || Win7 32|| Fedora 16
slestak989
 
Posts: 31
Joined: Tue Oct 04, 2011 3:40 am

Re: Default syntax mode for files without dot extensions

Postby aparajita on Fri Nov 25, 2011 3:58 am

Submit the patch as a pull request, I'll be happy to integrate it.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm

Re: Default syntax mode for files without dot extensions

Postby slestak989 on Mon Dec 05, 2011 5:52 pm

I think for the time being I am going to have to put St2 up and get back to vim. It is way too dynamic right now and I am spending too much non-project time fiddling with it. I'll check back in a few releases.
Using ST2 on: Win7 Pro 64 || Win7 32|| Fedora 16
slestak989
 
Posts: 31
Joined: Tue Oct 04, 2011 3:40 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 31 guests