(This isn't specifically a Textmate question, but I know a lot of Textmate users use Markdown, so I was hoping someone could help.)
How do I name Markdown files so that they are:
1) Recognized automatically by Textmate as Markdown files when you open them, 2) Indexed automatically by Spotlight, 3) Use a unique extension (like .markdown) rather than a generic .txt extension?
Right now, if I use the default .markdown extension, the file isn't indexed by Spotlight. If I save a Markdown file without any extension, it's neither indexed by Spotlight, nor is it recognized by Textmate as a Markdown file.
A .txt extension is recognized by Textmate and indexed by Spotlight, but I was hoping to use a different file extension--one that could distinguish Markdown files from other text files.
How do other people solve this problem?
Thanks, Tom **
On 21. Oct 2006, at 06:56, Tom Offermann wrote:
[...] Right now, if I use the default .markdown extension, the file isn't indexed by Spotlight. [...]
I think this is just a question of letting Spotlight now that .markdown files are text files. We can add the proper UTI for that in TextMate’s Info.plist (if that will solve it).
Let me check into that in nearest future, unless someone beats me to it.
On 21 oct. 06, at 08:30, Allan Odgaard wrote:
On 21. Oct 2006, at 06:56, Tom Offermann wrote:
[...] Right now, if I use the default .markdown extension, the file isn't indexed by Spotlight. [...]
I think this is just a question of letting Spotlight now that .markdown files are text files. We can add the proper UTI for that in TextMate’s Info.plist (if that will solve it).
Let me check into that in nearest future, unless someone beats me to it.
While you're at it, it would also be great to do this for .gtd files.
Thanks,
Alan
-- Alan Schmitt http://alan.petitepomme.net/
The hacker: someone who figured things out and made something cool happen. .O. ..O OOO
You need to set the UTI then add the new type to "/System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist" for text files or "/Library/Spotlight/SourceCode.mdimporter/Contents/Info.plist" for source files. (NB: SourceCode.mdimporter is installed with the dev tools).
It would be great if the UTIs were set in TextMate. For now I have a dummy "MyUTIs.bundle"[1] in my Applications folder just for that purpose.
[1]: http://geekthang.com/files/MyUTIs.bundle.zip
Unzip in your Applications folder and add new types to "/System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist". CFBundleDocumentTypes should look like this[2].
[2]: http://pastie.textmate.org/18835
You can then check in the Terminal if the type is correct and an mdimporter is found:
$ mdimport -n -d1 "YourFile.markdown" You should see: Import 'YourFile.markdown' type 'public.markdown.plain-text' using 'file://localhost/System/Library/Spotlight/RichText.mdimporter/'
If it's ok, import the folder or file: $ mdimport "path/to/folderorfile"
Check the link below for informations on how to make LaunchService recognize the new UTIs if it doesn't work immediately, etc.
Informations found in this hint[3] AND in the comments.
[3]: http://www.macosxhints.com/article.php?story=2005052015041510