Hello all,
I'm not sure if this is possible in TextMate, so I thought I'd ask. In any given project, I'm working with lots of different languages: HTML, PHP, CSS, JavaScript, Java, etc. I find that when I have all of these files open at the same time (in a project window), I'll set the language for the file I'm currently working on in the bottom language bar, and then when I switch to a different file TextMate just stays in that language I was working in, even though the new file is actually a different language! This happens even if I go through each file and set its language manually before switching between them. Is there something I'm missing? If not, I would absolutely love to see this in 2.0!
Thanks in advance,
Michael
____________________________________ Michael Jackson CFAC Web Development Brigham Young University Web: http://www.ajaxon.com/michael Email: mjijackson@gmail.com
On Mar 9, 2007, at 7:27 PM, Michael Jackson wrote:
Hello all,
I'm not sure if this is possible in TextMate, so I thought I'd ask. In any given project, I'm working with lots of different languages: HTML, PHP, CSS, JavaScript, Java, etc. I find that when I have all of these files open at the same time (in a project window), I'll set the language for the file I'm currently working on in the bottom language bar, and then when I switch to a different file TextMate just stays in that language I was working in, even though the new file is actually a different language! This happens even if I go through each file and set its language manually before switching between them. Is there something I'm missing? If not, I would absolutely love to see this in 2.0!
Thanks in advance,
This should not be happening, unless those files all have the same extension. Once you send language type for a particular extension, TM remembers it for all other files of that extension, but other than that it should really use different language for each file.
Michael
Haris Skiadas Department of Mathematics and Computer Science Hanover College
Ah yes. Some of the files that I work on actually do have the same extension, but I'd like them to be highlighted in different languages. For example, sometimes I generate CSS files with php. The file will be named something like: style.css.php. What I would like to do is tell TextMate that, even though this file has a php extension, it's really CSS, and for TextMate to remember that I told it that this particular file is CSS. Probably not enough people with this same problem to worry about it though! Thanks for the response.
On Mar 9, 2007, at 5:50 PM, Charilaos Skiadas wrote:
On Mar 9, 2007, at 7:27 PM, Michael Jackson wrote:
Hello all,
I'm not sure if this is possible in TextMate, so I thought I'd ask. In any given project, I'm working with lots of different languages: HTML, PHP, CSS, JavaScript, Java, etc. I find that when I have all of these files open at the same time (in a project window), I'll set the language for the file I'm currently working on in the bottom language bar, and then when I switch to a different file TextMate just stays in that language I was working in, even though the new file is actually a different language! This happens even if I go through each file and set its language manually before switching between them. Is there something I'm missing? If not, I would absolutely love to see this in 2.0!
Thanks in advance,
This should not be happening, unless those files all have the same extension. Once you send language type for a particular extension, TM remembers it for all other files of that extension, but other than that it should really use different language for each file.
Michael
Haris Skiadas Department of Mathematics and Computer Science Hanover College
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 10. Mar 2007, at 06:43, Michael Jackson wrote:
Ah yes. Some of the files that I work on actually do have the same extension, but I'd like them to be highlighted in different languages. For example, sometimes I generate CSS files with php. The file will be named something like: style.css.php. What I would like to do is tell TextMate that, even though this file has a php extension, it's really CSS,
If you go to the bundle editor and locate the CSS language grammar, you can put ‘css.php’ in the file types array, that should make it treat files with this double extension as CSS.
On Mar 10, 2007, at 7:57 AM, Allan Odgaard wrote:
On 10. Mar 2007, at 06:43, Michael Jackson wrote:
Ah yes. Some of the files that I work on actually do have the same extension, but I'd like them to be highlighted in different languages. For example, sometimes I generate CSS files with php. The file will be named something like: style.css.php. What I would like to do is tell TextMate that, even though this file has a php extension, it's really CSS,
If you go to the bundle editor and locate the CSS language grammar, you can put ‘css.php’ in the file types array, that should make it treat files with this double extension as CSS.
but won't this be deleted with an svn-update of the css-bundle?
Niels
On 10. Mar 2007, at 07:59, Niels Kobschätzki wrote:
On Mar 10, 2007, at 7:57 AM, Allan Odgaard wrote:
On 10. Mar 2007, at 06:43, Michael Jackson wrote:
Ah yes. Some of the files that I work on actually do have the same extension, but I'd like them to be highlighted in different languages. For example, sometimes I generate CSS files with php. The file will be named something like: style.css.php. What I would like to do is tell TextMate that, even though this file has a php extension, it's really CSS,
If you go to the bundle editor and locate the CSS language grammar, you can put ‘css.php’ in the file types array, that should make it treat files with this double extension as CSS.
but won't this be deleted with an svn-update of the css-bundle?
If you have the checkout in /Library, doing the edit will produce the file ~/Library/Applicationn Support/TextMate/Bundles/CSS.tmbundle/ Syntaxes/CSS.tmDelta which contains just the new fileTypes array.
If you have the checkout in ~/Library, the file will be locally modified, and svn will gracefully merge updated versions of the CSS grammar with the local changes (until the default grammar has the fileTypes array changed, in which case there will be a merge conflict which require manual sorting, but unlikely the fileType array is going to change anytime soon).
If you do not have a checkout, the first scenario applies.
On Mar 9, 2007, at 11:57 PM, Allan Odgaard wrote:
Ah yes. Some of the files that I work on actually do have the same extension, but I'd like them to be highlighted in different languages. For example, sometimes I generate CSS files with php. The file will be named something like: style.css.php. What I would like to do is tell TextMate that, even though this file has a php extension, it's really CSS,
If you go to the bundle editor and locate the CSS language grammar, you can put ‘css.php’ in the file types array, that should make it treat files with this double extension as CSS.
I tried to follow these instructions but no luck. I modified the fileTypes array in the CSS language file to look like this:
fileTypes = ( 'css', 'css.php' );
but TM still won't recognize the css.php extension as CSS. Instead, it reverts to PHP every time. Any ideas as to why this is happening?
On 10. Mar 2007, at 17:50, Michael Jackson wrote:
If you go to the bundle editor and locate the CSS language grammar, you can put ‘css.php’ in the file types array, that should make it treat files with this double extension as CSS.
I tried to follow these instructions but no luck. I modified the fileTypes array in the CSS language file to look like this:
fileTypes = ( 'css', 'css.php' );
but TM still won't recognize the css.php extension as CSS. Instead, it reverts to PHP every time. Any ideas as to why this is happening?
You say *revery* -- what happens if you do: mate /tmp/test.css.php?
I did test it, and it works fine for me.
You can see which file type bindings TM has stored (as memory) by running this from Terminal:
defaults read com.macromates.textmate OakLanguageFileBindings
I don’t think it will ever store a double-extension binding, but I honestly can’t remember, so to clear the memory, quit TM and run:
defaults delete com.macromates.textmate OakLanguageFileBindings
Also, be sure to have closed the bundle editor, after you edited the CSS grammar (for changes to be committed).
On Mar 10, 2007, at 5:57 PM, Allan Odgaard wrote:
If you go to the bundle editor and locate the CSS language grammar, you can put ‘css.php’ in the file types array, that should make it treat files with this double extension as CSS.
I tried to follow these instructions but no luck. I modified the fileTypes array in the CSS language file to look like this:
fileTypes = ( 'css', 'css.php' );
but TM still won't recognize the css.php extension as CSS. Instead, it reverts to PHP every time. Any ideas as to why this is happening?
You say *revery* -- what happens if you do: mate /tmp/test.css.php?
I did test it, and it works fine for me.
You can see which file type bindings TM has stored (as memory) by running this from Terminal:
defaults read com.macromates.textmate OakLanguageFileBindings
I don’t think it will ever store a double-extension binding, but I honestly can’t remember, so to clear the memory, quit TM and run:
defaults delete com.macromates.textmate OakLanguageFileBindings
Also, be sure to have closed the bundle editor, after you edited the CSS grammar (for changes to be committed).
Well, it's true what you say. I can delete all of the defaults and do: mate /tmp/test.css.php from the command line, and it will open up the file as CSS. However, afterwards if I do: mate /tmp/test.php, it will open up as HTML! So then, when I manually change that one back to php, the mate /tmp/test.css.php will open up as php! I don't think TM has the support for double extensions, but it would be nice in this instance.
By the way Allan, I love the editor. Thanks for your help and keep up the great work.
On 11. Mar 2007, at 06:43, Michael Jackson wrote:
Well, it's true what you say. I can delete all of the defaults and do: mate /tmp/test.css.php from the command line, and it will open up the file as CSS. However, afterwards if I do: mate /tmp/ test.php, it will open up as HTML!
And that is correct -- we bind *.php to HTML by default because it is HTML with <?php … ?> tags in it.
So then, when I manually change that one back to php, the mate /tmp/ test.css.php will open up as php! I don't think TM has the support for double extensions, but it would be nice in this instance.
It does, just either a) use HTML for PHP (for this and other reasons) or b) if you really insist on using the PHP grammar as root for your *.php files (which means you will lose coloring of HTML tags outside <?php … ?>), go edit the fileTypes arrays for the PHP and HTML grammars, but I do not recommend it.
On Mar 9, 2007, at 11:57 PM, Allan Odgaard wrote:
On 10. Mar 2007, at 06:43, Michael Jackson wrote:
Ah yes. Some of the files that I work on actually do have the same extension, but I'd like them to be highlighted in different languages. For example, sometimes I generate CSS files with php. The file will be named something like: style.css.php. What I would like to do is tell TextMate that, even though this file has a php extension, it's really CSS,
If you go to the bundle editor and locate the CSS language grammar, you can put ‘css.php’ in the file types array, that should make it treat files with this double extension as CSS.
This doesn't work for me. Has anybody else done something similar and gotten it to work?
On 10 Mar 2007, at 22:27, Michael Jackson wrote:
On Mar 9, 2007, at 11:57 PM, Allan Odgaard wrote:
On 10. Mar 2007, at 06:43, Michael Jackson wrote:
Ah yes. Some of the files that I work on actually do have the same extension, but I'd like them to be highlighted in different languages. For example, sometimes I generate CSS files with php. The file will be named something like: style.css.php. What I would like to do is tell TextMate that, even though this file has a php extension, it's really CSS,
If you go to the bundle editor and locate the CSS language grammar, you can put ‘css.php’ in the file types array, that should make it treat files with this double extension as CSS.
This doesn't work for me. Has anybody else done something similar and gotten it to work?
Perhaps TabMate will help? http://konstochvanligasaker.se/tabmate/ NB I've never tried it