Different Themes based on file type

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Different Themes based on file type

Umberto Cerrato
Hi,

Is there a function to make TextMate 2 opens a certain file type using a specific theme? e.g. there is the default theme and then you can set TM to open html files using another theme.

Best, u

PS:
I need it!! I do not know why only few Text Editors have this feature…

_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Rob McBroom-4

On 23 Aug 2019, at 7:45, Umberto Cerrato wrote:

Is there a function to make TextMate 2 opens a certain file type using a specific theme? e.g. there is the default theme and then you can set TM to open html files using another theme.

This is what I have in ~/.tm_properties to make certain types open with a light theme.

[ text.plain,text.html,text.mail ]
theme = "3A9E8876-6DBD-4696-871F-95D340F8BA27"

As you can see, you need to provide the UUID for the theme, not the name.

--
Rob McBroom



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Umberto Cerrato
Thank you Rob, I’ll try asap!

Best

> Il giorno 23 ago 2019, alle ore 14:14, Rob McBroom <[hidden email]> ha scritto:
>
> On 23 Aug 2019, at 7:45, Umberto Cerrato wrote:
>
> Is there a function to make TextMate 2 opens a certain file type using a specific theme? e.g. there is the default theme and then you can set TM to open html files using another theme.
>
> This is what I have in ~/.tm_properties to make certain types open with a light theme.
>
> [ text.plain,text.html,text.mail ]
> theme = "3A9E8876-6DBD-4696-871F-95D340F8BA27"
> As you can see, you need to provide the UUID for the theme, not the name.
>
> --
> Rob McBroom
>
>
> _______________________________________________
> TextMate mailing list
> [hidden email]
> https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Umberto Cerrato
Hi,

I found the Global.tmProperties file. It does work. This is my “configuration”:

[ source.c ]
theme            = "71D40D9D-AE48-11D9-920A-000D93589AF6"
tabSize = 4

However, I didn’t manage to have this configuration to work for other formats too. e.g. [ *.c,*.cpp ] does not work neither do [ source.c, source.cpp ] and [ text.c, text.cpp ]. What am I missing?

Best, u

Il giorno 23 ago 2019, alle ore 15:11, Umberto Cerrato <[hidden email]> ha scritto:

Thank you Rob, I’ll try asap!

Best

Il giorno 23 ago 2019, alle ore 14:14, Rob McBroom <[hidden email]> ha scritto:

On 23 Aug 2019, at 7:45, Umberto Cerrato wrote:

Is there a function to make TextMate 2 opens a certain file type using a specific theme? e.g. there is the default theme and then you can set TM to open html files using another theme.

This is what I have in ~/.tm_properties to make certain types open with a light theme.

[ text.plain,text.html,text.mail ]
theme = "3A9E8876-6DBD-4696-871F-95D340F8BA27"
As you can see, you need to provide the UUID for the theme, not the name.

-- 
Rob McBroom


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Umberto Cerrato
Hello,

I found a solution.

[ *{c,cpp} ]
tabSize          = 4
theme            = 71D40D9D-AE48-11D9-920A-000D93589AF6

Hope it will be useful to someone :)

Best

Il giorno 23 ago 2019, alle ore 15:51, Umberto Cerrato <[hidden email]> ha scritto:

Hi,

I found the Global.tmProperties file. It does work. This is my “configuration”:

[ source.c ]
theme            = "71D40D9D-AE48-11D9-920A-000D93589AF6"
tabSize
= 4

However, I didn’t manage to have this configuration to work for other formats too. e.g. [ *.c,*.cpp ] does not work neither do [ source.c, source.cpp ] and [ text.c, text.cpp ]. What am I missing?

Best, u

Il giorno 23 ago 2019, alle ore 15:11, Umberto Cerrato <[hidden email]> ha scritto:

Thank you Rob, I’ll try asap!

Best

Il giorno 23 ago 2019, alle ore 14:14, Rob McBroom <[hidden email]> ha scritto:

On 23 Aug 2019, at 7:45, Umberto Cerrato wrote:

Is there a function to make TextMate 2 opens a certain file type using a specific theme? e.g. there is the default theme and then you can set TM to open html files using another theme.

This is what I have in ~/.tm_properties to make certain types open with a light theme.

[ text.plain,text.html,text.mail ]
theme = "3A9E8876-6DBD-4696-871F-95D340F8BA27"
As you can see, you need to provide the UUID for the theme, not the name.

-- 
Rob McBroom


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Dr Eberhard W Lisse
In reply to this post by Umberto Cerrato
ate Umberto,

TextMate does open different files in corresponding modes.  I don't
think you can change the Theme depending on file type, if only because
of the complexity and the requirments for Themes to be available.

I also don't see the necessity, as the modes are very helpful alread
and can even be triggered in pipe mode with the -t parameter.

This bash code tells you what modes are currently available:

find ~/Library/Application\ Support/TextMate/Managed/Bundles \
   -depth 1 -name '*.tmbundle' -exec bash -c '
      tput bold;
      echo -n "$(defaults read "{}/info.plist" name): ";
      tput sgr0;
      echo $(if cd "{}/Syntaxes" 2>/dev/null;
         then
            for syntax in *.plist *.tmLanguage;
            do
               if [ -f "${syntax}" ];
               then
                  /usr/libexec/PlistBuddy -c \
                     "Print :scopeName" "${syntax}" \
                     2>/dev/null \
                  | grep -v "[\{\}]";
               fi;
            done;
         fi)' \; \
| sort -f

el


On 2019-08-23 13:45 , Umberto Cerrato wrote:

> Hi,
>
> Is there a function to make TextMate 2 opens a certain file type using
> a specific theme?  e.g. there is the default theme and then you can
> set TM to open html files using another theme.
>
> Best, u
>
> PS:
> I need it!!  I do not know why only few Text Editors have this
> feature…
>
> _______________________________________________
> TextMate mailing list
> [hidden email]
> https://lists.macromates.com/listinfo/textmate
>

--
Dr. Eberhard W. Lisse          / Obstetrician & Gynaecologist (Saar)
[hidden email]            / *     |   Telephone: +264 81 124 6733 (cell)
PO Box 8421                  /
Bachbrecht, Namibia     ;____/

_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Allan Odgaard-4
In reply to this post by Umberto Cerrato

On 23 Aug 2019, at 16:14, Umberto Cerrato wrote:

I found a solution.

[ *{c,cpp} ]
tabSize = 4
theme = 71D40D9D-AE48-11D9-920A-000D93589AF6

The thing in the square brackets is a file system glob, which is what you currently use, but the one above also match files like fooc and foocpp (as there is no dot in the glob).

So instead you should want to use:

[ *.{c,cpp} ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

As an alternative to a file system glob, it is possible to use a “scope selector” which would be source.c and source.c++, for example:

[ 'source.c, source.c++' ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

The advantage with this is that it will target all C and C++ files, even if they do not have a .c or .cpp extension.



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Umberto Cerrato
Hi,

Yeah I knew that and in my properties file I wrote like you did. I already sent the mail then.
Anyway thank you.

About the source, I didn’t know that! (About it can match the language also if the extension is different)
And I didn’t know you can list them all together with quotes neither.

Thanks

U

 

> Il giorno 26 ago 2019, alle ore 10:01, Allan Odgaard <[hidden email]> ha scritto:
>
> On 23 Aug 2019, at 16:14, Umberto Cerrato wrote:
>
> I found a solution.
>
> [ *{c,cpp} ]
> tabSize = 4
> theme = 71D40D9D-AE48-11D9-920A-000D93589AF6
>
> The thing in the square brackets is a file system glob, which is what you currently use, but the one above also match files like fooc and foocpp (as there is no dot in the glob).
>
> So instead you should want to use:
>
> [ *.{c,cpp} ]
> tabSize = 4
> theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6
>
> As an alternative to a file system glob, it is possible to use a “scope selector” which would be source.c and source.c++, for example:
>
> [ 'source.c, source.c++' ]
> tabSize = 4
> theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6
>
> The advantage with this is that it will target all C and C++ files, even if they do not have a .c or .cpp extension.
>
>
> _______________________________________________
> TextMate mailing list
> [hidden email]
> https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Umberto Cerrato
PS:

This seems to work too...

[ 'source.*{c, c++, python}' ]
tabSize          = 4
theme            = 71D40D9D-AE48-11D9-920A-000D93589AF6

Il giorno 26 ago 2019, alle ore 11:56, Umberto Cerrato <[hidden email]> ha scritto:

Hi,

Yeah I knew that and in my properties file I wrote like you did. I already sent the mail then.
Anyway thank you.

About the source, I didn’t know that! (About it can match the language also if the extension is different)
And I didn’t know you can list them all together with quotes neither.

Thanks

U



Il giorno 26 ago 2019, alle ore 10:01, Allan Odgaard <[hidden email]> ha scritto:

On 23 Aug 2019, at 16:14, Umberto Cerrato wrote:

I found a solution.

[ *{c,cpp} ]
tabSize = 4
theme = 71D40D9D-AE48-11D9-920A-000D93589AF6

The thing in the square brackets is a file system glob, which is what you currently use, but the one above also match files like fooc and foocpp (as there is no dot in the glob).

So instead you should want to use:

[ *.{c,cpp} ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

As an alternative to a file system glob, it is possible to use a “scope selector” which would be source.c and source.c++, for example:

[ 'source.c, source.c++' ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

The advantage with this is that it will target all C and C++ files, even if they do not have a .c or .cpp extension.


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate



Inizio messaggio inoltrato:

Da: Umberto Cerrato <[hidden email]>

Oggetto: [TxMt] Re: Different Themes based on file type

Data: 26 agosto 2019 11:56:47 CEST

A: "[textmate]" <[hidden email]>

Rispondi a: TextMate users <[hidden email]>


Hi,

Yeah I knew that and in my properties file I wrote like you did. I already sent the mail then.
Anyway thank you.

About the source, I didn’t know that! (About it can match the language also if the extension is different)
And I didn’t know you can list them all together with quotes neither.

Thanks

U



Il giorno 26 ago 2019, alle ore 10:01, Allan Odgaard <[hidden email]> ha scritto:

On 23 Aug 2019, at 16:14, Umberto Cerrato wrote:

I found a solution.

[ *{c,cpp} ]
tabSize = 4
theme = 71D40D9D-AE48-11D9-920A-000D93589AF6

The thing in the square brackets is a file system glob, which is what you currently use, but the one above also match files like fooc and foocpp (as there is no dot in the glob).

So instead you should want to use:

[ *.{c,cpp} ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

As an alternative to a file system glob, it is possible to use a “scope selector” which would be source.c and source.c++, for example:

[ 'source.c, source.c++' ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

The advantage with this is that it will target all C and C++ files, even if they do not have a .c or .cpp extension.


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


Inizio messaggio inoltrato:

Da: Umberto Cerrato <[hidden email]>

Oggetto: [TxMt] Re: Different Themes based on file type

Data: 26 agosto 2019 11:56:47 CEST

A: "[textmate]" <[hidden email]>

Rispondi a: TextMate users <[hidden email]>


Hi,

Yeah I knew that and in my properties file I wrote like you did. I already sent the mail then.
Anyway thank you.

About the source, I didn’t know that! (About it can match the language also if the extension is different)
And I didn’t know you can list them all together with quotes neither.

Thanks

U



Il giorno 26 ago 2019, alle ore 10:01, Allan Odgaard <[hidden email]> ha scritto:

On 23 Aug 2019, at 16:14, Umberto Cerrato wrote:

I found a solution.

[ *{c,cpp} ]
tabSize = 4
theme = 71D40D9D-AE48-11D9-920A-000D93589AF6

The thing in the square brackets is a file system glob, which is what you currently use, but the one above also match files like fooc and foocpp (as there is no dot in the glob).

So instead you should want to use:

[ *.{c,cpp} ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

As an alternative to a file system glob, it is possible to use a “scope selector” which would be source.c and source.c++, for example:

[ 'source.c, source.c++' ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

The advantage with this is that it will target all C and C++ files, even if they do not have a .c or .cpp extension.


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


Inizio messaggio inoltrato:

Da: Umberto Cerrato <[hidden email]>

Oggetto: [TxMt] Re: Different Themes based on file type

Data: 26 agosto 2019 11:56:47 CEST

A: "[textmate]" <[hidden email]>

Rispondi a: TextMate users <[hidden email]>


Hi,

Yeah I knew that and in my properties file I wrote like you did. I already sent the mail then.
Anyway thank you.

About the source, I didn’t know that! (About it can match the language also if the extension is different)
And I didn’t know you can list them all together with quotes neither.

Thanks

U



Il giorno 26 ago 2019, alle ore 10:01, Allan Odgaard <[hidden email]> ha scritto:

On 23 Aug 2019, at 16:14, Umberto Cerrato wrote:

I found a solution.

[ *{c,cpp} ]
tabSize = 4
theme = 71D40D9D-AE48-11D9-920A-000D93589AF6

The thing in the square brackets is a file system glob, which is what you currently use, but the one above also match files like fooc and foocpp (as there is no dot in the glob).

So instead you should want to use:

[ *.{c,cpp} ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

As an alternative to a file system glob, it is possible to use a “scope selector” which would be source.c and source.c++, for example:

[ 'source.c, source.c++' ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

The advantage with this is that it will target all C and C++ files, even if they do not have a .c or .cpp extension.


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


Inizio messaggio inoltrato:

Da: Umberto Cerrato <[hidden email]>

Oggetto: [TxMt] Re: Different Themes based on file type

Data: 26 agosto 2019 11:56:47 CEST

A: "[textmate]" <[hidden email]>

Rispondi a: TextMate users <[hidden email]>


Hi,

Yeah I knew that and in my properties file I wrote like you did. I already sent the mail then.
Anyway thank you.

About the source, I didn’t know that! (About it can match the language also if the extension is different)
And I didn’t know you can list them all together with quotes neither.

Thanks

U



Il giorno 26 ago 2019, alle ore 10:01, Allan Odgaard <[hidden email]> ha scritto:

On 23 Aug 2019, at 16:14, Umberto Cerrato wrote:

I found a solution.

[ *{c,cpp} ]
tabSize = 4
theme = 71D40D9D-AE48-11D9-920A-000D93589AF6

The thing in the square brackets is a file system glob, which is what you currently use, but the one above also match files like fooc and foocpp (as there is no dot in the glob).

So instead you should want to use:

[ *.{c,cpp} ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

As an alternative to a file system glob, it is possible to use a “scope selector” which would be source.c and source.c++, for example:

[ 'source.c, source.c++' ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

The advantage with this is that it will target all C and C++ files, even if they do not have a .c or .cpp extension.


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


Inizio messaggio inoltrato:

Da: Umberto Cerrato <[hidden email]>

Oggetto: [TxMt] Re: Different Themes based on file type

Data: 26 agosto 2019 11:56:47 CEST

A: "[textmate]" <[hidden email]>

Rispondi a: TextMate users <[hidden email]>


Hi,

Yeah I knew that and in my properties file I wrote like you did. I already sent the mail then.
Anyway thank you.

About the source, I didn’t know that! (About it can match the language also if the extension is different)
And I didn’t know you can list them all together with quotes neither.

Thanks

U



Il giorno 26 ago 2019, alle ore 10:01, Allan Odgaard <[hidden email]> ha scritto:

On 23 Aug 2019, at 16:14, Umberto Cerrato wrote:

I found a solution.

[ *{c,cpp} ]
tabSize = 4
theme = 71D40D9D-AE48-11D9-920A-000D93589AF6

The thing in the square brackets is a file system glob, which is what you currently use, but the one above also match files like fooc and foocpp (as there is no dot in the glob).

So instead you should want to use:

[ *.{c,cpp} ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

As an alternative to a file system glob, it is possible to use a “scope selector” which would be source.c and source.c++, for example:

[ 'source.c, source.c++' ]
tabSize = 4
theme   = 71D40D9D-AE48-11D9-920A-000D93589AF6

The advantage with this is that it will target all C and C++ files, even if they do not have a .c or .cpp extension.


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Allan Odgaard-4

On 26 Aug 2019, at 12:13, Umberto Cerrato wrote:

This seems to work too...

[ 'source.*{c, c++, python}' ]

It may seem to work, but it shouldn’t, that is, source.* will match all source documents (as opposed to text.*), the following braces are non-sensical, and the comma will be interpreted as scope selector delimiter.

Either use a file glob or use scope selectors.

For more information about scope selectors I suggest these two resources:

TextMate 1.5.1 manual (but concept is the same for 2.0): https://macromates.com/manual/en/scope_selectors
Blog post: https://macromates.com/blog/2005/introduction-to-scopes/



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Different Themes based on file type

Umberto Cerrato
:/ I’m sorry.

Yeah

Best

> Il giorno 26 ago 2019, alle ore 12:29, Allan Odgaard <[hidden email]> ha scritto:
>
> On 26 Aug 2019, at 12:13, Umberto Cerrato wrote:
>
> This seems to work too...
>
> [ 'source.*{c, c++, python}' ]
>
> It may seem to work, but it shouldn’t, that is, source.* will match all source documents (as opposed to text.*), the following braces are non-sensical, and the comma will be interpreted as scope selector delimiter.
>
> Either use a file glob or use scope selectors.
>
> For more information about scope selectors I suggest these two resources:
>
> TextMate 1.5.1 manual (but concept is the same for 2.0): https://macromates.com/manual/en/scope_selectors
> Blog post: https://macromates.com/blog/2005/introduction-to-scopes/
>
>
> _______________________________________________
> TextMate mailing list
> [hidden email]
> https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate