[TxMt] How to force grammar per file?

2 views
Skip to first unread message

Brandon Fryslie

unread,
Mar 13, 2012, 12:41:04 AM3/13/12
to text...@lists.macromates.com
I am somewhat aware of how the default grammar is picked for a filetype (correct me if I am wrong, but I believe it is the grammar chosen when the last file of that type was saved).  So I recently edited a Latex file with an extension of .txt, and now .txt files open with the Latex grammar chosen.  

Can I force TextMate 2 to use Markdown for all .txt files by default while allowing me to selectively change some .txt files to other grammars, without changing the default grammar for all files of that type?  

Thanks!!

-- 
Brandon Fryslie
http://www.MateWiki.com - A TextMate 2 Wiki

Allan Odgaard

unread,
Mar 16, 2012, 2:10:37 AM3/16/12
to TextMate users
On 13/03/2012, at 11.41, Brandon Fryslie wrote:

> […] Can I force TextMate 2 to use Markdown for all .txt files by default while allowing me to selectively change some .txt files to other grammars, without changing the default grammar for all files of that type?

You can set fileType in .tm_properties which can target folders and file globs. E.g.:

[ *.txt ]
fileType = "text.html.markdown"

[ Documents/*.txt ]
fileType = "text.plain"

_______________________________________________
textmate mailing list
text...@lists.macromates.com
http://lists.macromates.com/listinfo/textmate

Reply all
Reply to author
Forward
0 new messages