Home Download Buy Blog Forum Support

SublimeModelines plugin

SublimeModelines plugin

Postby guillermooo on Thu Apr 22, 2010 8:09 pm

Adds support for vim-like modelines to Sublime.

https://github.com/SublimeText/Modelines
Last edited by guillermooo on Sat Jul 16, 2011 7:49 pm, edited 1 time in total.
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: SublimeModelines plugin

Postby jps on Tue Apr 27, 2010 2:12 pm

Thanks, I've wanted modelines support for a while!
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: SublimeModelines plugin

Postby guillermooo on Sat Jul 16, 2011 7:49 pm

Updated!

* Fixed bugs in conversion from string to JSON type
* Better error reporting

https://github.com/SublimeText/Modelines
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: SublimeModelines plugin

Postby dsarch on Mon Jul 18, 2011 2:41 am

Hello @guilhermoo,

How can i set a modeline for a setting the filetype (to have syntax) ?

I want to make a file named bashrc have the shell syntax.

Thanks !
dsarch
 
Posts: 62
Joined: Tue May 03, 2011 2:31 am

Re: SublimeModelines plugin

Postby guillermooo on Mon Jul 18, 2011 5:32 am

This should do it:

Code: Select all
# sublime: syntax 'Packages/ShellScript/Shell-Unix-Generic.tmLanguage'
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: SublimeModelines plugin

Postby dsarch on Mon Jul 18, 2011 10:20 am

Hello @guillermoo,

Thanks for the example ! It worked fine =)

Also, im trying to set the syntax for *.dtml files (which i need to render as css) and *.zcml (which i need to render as xml).

I trying to make *.zcml work, but the only way it works is as follow:

Code: Select all
<!--
# sublime: syntax 'Packages/XML/XML.tmLanguage'
-->


I tried a lot of variations without the # character, but i did not had success.

I did not managed to make CSS in dtml in any way.

Can you help me ? Thanks a lot !
dsarch
 
Posts: 62
Joined: Tue May 03, 2011 2:31 am

Re: SublimeModelines plugin

Postby guillermooo on Mon Jul 18, 2011 10:33 am

If you want to always use a syntax definition with certain file extensions, you'll be better served by View > Syntax > Open all with current extension as....

Modelines are intended for single files, which I think is the case with .*rc files.
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: SublimeModelines plugin

Postby dsarch on Mon Jul 18, 2011 1:05 pm

Thanks again, @guilermoo !

I did not know that option, but it still seems to be a bug to me. When i try to set the syntax of a file to css, it does not work.

I have just one dtml file and i would like to set the syntax just for it, as *.dtml may be used for other things like sql and so on.

Thanks again !
dsarch
 
Posts: 62
Joined: Tue May 03, 2011 2:31 am

Re: SublimeModelines plugin

Postby guillermooo on Mon Jul 18, 2011 1:10 pm

Currently SublimeModelines only looks for single-line comment characters, which does not apply to html files; I haven't doublecheked, but I suppose the html package defines only multi-line comments, which confuse SublimeModelines. I will take a look and see if I can make modelines work in these cases too.
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: SublimeModelines plugin

Postby dsarch on Mon Jul 18, 2011 1:39 pm

Thanks a lot for your effort !

The strange thing is that XML comments (multi-line) work with this workaround:

Code: Select all
<!--
# sublime: syntax 'Packages/XML/XML.tmLanguage'
-->


But the CSS (which define multi-line comments) does not work (i tried almost everything).
dsarch
 
Posts: 62
Joined: Tue May 03, 2011 2:31 am

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 15 guests