Hi there,
Just change the "Print :fileTypes" to "Print :scopeName" in my command
line. This will
print out what you need. Even "source.perl" and "source.perl.6".
After that just unwrap that proof-of-concept on-liner, clean it up into a nice shell
script, better protect things against error cases, so it won't run wild on you in a
worst case scenario, and you should be all set. :-)
On 23 Apr 2019, at 10:13 AM, Dr Eberhard W Lisse
<el(a)lisse.na> wrote:
Thanks,
the find command (for which one needs a concealed carry permit :-)-O)
works but it returns the extensions (or filenames) by which TextMate
recognizes the type.
Grepping around in plist files showed stuff like
<string>source.r</string>
<string>source.ruby</string>
so
mate -t source.r -
mate -t source.makefile -
mate -t source.perl -
and after a little experimenting
mate -t text.tabular.csv -
work (even if source.perl did not come up in the grep) if the
corresponding bundle is installed.
And TextMate evaluates the shebang which also works in a pipe.
So that solves my problem, but I am still wondering if a complete list,
or the logic used should not be published somewhere...
el
On 23/04/2019 3:35 am, じょいすじょん wrote:
This should be somewhat rare, but what would be valuable to know is,
does it accept UTIs? or file extensions? or some list of names?
> On Apr 23, 2019, at 8:04, Christian Rosentreter <karibu(a)gmx.net> wrote:
>
>
> Hi there,
>
>> On 23 Apr 2019, at 12:01 AM, Dr Eberhard W Lisse <el(a)lisse.na> wrote:
>>
>> Yes, and no.
>>
>> I would like to know which (common) ones are possible, or how I can find
>> that (which ones are installed/available) out, so that if I use "mate
-"
>> in a pipe I can "load" the required bundle and make use of its
>> facilities without having to resort to selecting filetype with the
>> mouse.
>>
>> Probably something of use to others as well.
>
>
> Maybe use something like this insane one-liner:
>
> 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
:fileTypes"
> "${syntax}" 2>/dev/null | grep -v "[\{\}]"; fi; done; fi)'
\;
>
>
> Actually, please don't try that. You've been warned! :-) But
> probably something like this could be done properly in a shell
> script. Just scan the available bundles and extract the required
> information directly. I'm not sure what "filetype" the mate command
> actually wants (maybe using the scopeName from the syntax file would
> be the right choice?).
>
> Just providing some wild ideas…
--
Dr. Eberhard W. Lisse / Obstetrician & Gynaecologist (Saar)
el(a)lisse.NA / * | Telephone: +264 81 124 6733 (cell)
PO Box 8421 /
Bachbrecht, Namibia ;____/
_______________________________________________
textmate mailing list
textmate(a)lists.macromates.com
https://lists.macromates.com/listinfo/textmate