[TxMt] Re: recognition of file type in pipe

René Schwaiger sanssecours at me.com
Wed Nov 7 18:37:06 UTC 2018


Hi,

> On 07.11.2018, at 19:12 , mail at bibiko.de wrote:
> 
> 
> 
>> On 7. Nov 2018, at 13:44, Dr Eberhard W Lisse <el at lisse.na> wrote:
>> 
>> I occasionally want to pipe JSON (or XML, or other formats) like
>> 
>> 	csvjson file.csv | mate -
>> 
>> It does display the file but as plain text.
> 
> my hack would be 
> 
> csvjson file.csv > /tmp/___q.json | mate -m untitled /tmp/___q.json && rm /tmp/___q.json
> 
> ergo write to a file with the desired extension first, then open it in TM as ‘untitled’ and finally remove the temporary file.
> 
> Option -t for mate doesn’t work either for me.
> 
> -Hans

I think you need to specify the grammar name [1] after the option `-t`. At least the following command works on my machine:

    echo '"Hello JSON"' |  mate -t source.json

.

Kind regards,
  René

[1]: https://macromates.com/manual/en/language_grammars




More information about the textmate mailing list