[TxMt] Re: Can I hide .txt extension in TextMate?

Allan Odgaard mailinglist at textmate.org
Fri Jan 7 08:29:16 UTC 2011


On 5 Jan 2011, at 20:16, Steve King wrote:

> […] The 'file' command does this pretty successfully, though it does sometimes get fooled trying to identify the specifics of text files.

The main type used with TextMate… ;)

> Many editors use a combination of content detection and file extension to figure out the file type.  (That's a hint, Allan! :-)

TextMate does that as well via the firstLineMatch in grammars.

Though having to infer file type from content is IMHO often a bad idea.

Consider a hypothetical file browser which allows you to specify user actions based on the file type. If you are browsing a network share, showing the proper actions for your files now require sending (lots of) content over the network.

You may also browse /etc where some files are readable only by root. The file browser probably has a way to request admin privileges when needed, so should it have a demon (running as root) help it determine the file types?

There is also the case of envelope file types, for example if a file has the magic gzip header, should it be decompressed and resubmitted to a file type test?




More information about the textmate mailing list