V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Daring Fireball: Markdown
CommonMark
MacDown Open Source Markdown Editor
Marked
GitHub Flavored Markdown
gogozs
V2EX  ›  Markdown

怎么在 OS X 上用 Finder 检索 Markdown 文件?

  •  
  •   gogozs · 2015-04-18 20:56:15 +08:00 · 5024 次点击
    这是一个创建于 3593 天前的主题,其中的信息可能已经有所发展或是发生改变。
    想搜索文件后缀为 md 的 Markdown 文件的内容,发现不能在 Finder 里搜索。但后缀改为 txt 就可以了。有什么方法可以直接搜索后缀为 md 的文件内容呢?
    第 1 条附言  ·  2015-04-19 09:34:35 +08:00
    题主已经用这个 gist 解决了问题

    Mac OSX Spotlight Enhancement

    Add this to Info.plist in /System/Library/Spotlight/RichText.mdimporter/Contents/ and Spotlight will search for source code files.

    <string>public.c-header</string>
    <string>public.c-plus-plus-header</string>
    <string>public.c-source</string>
    <string>public.objective-c-source</string>
    <string>public.c-plus-plus-source</string>
    <string>public.objective-c-plus-plus-source</string>
    <string>com.sun.java-source</string>
    <string>public.perl-script</string>
    <string>public.python-script</string>
    <string>public.csh-script</string>
    <string>public.shell-script</string>
    <string>public.ruby-script</string>
    <string>public.php-script</string>
    <string>com.netscape.javascript-source</string>
    <string>net.daringfireball.markdown</string>
    

    To find the entry for other file extensions do:

    mdimport -n -d1 somefile.ext
    

    After adding the desired file types you have to run

    mdimport -r /System/Library/Spotlight/RichText.mdimporter
    

    to update the new file extensions.

    To re-index the HD you can run

    sudo mdutil -E /
    

    To implement an easy command to search via the Terminal using Spotlight install spotfind.sh from https://github.com/mattheworiordan/Mac-OS-X-Useful-Scripts

    To add system folders to the search index use the script above and execute

    spotfind -c
    

    More Information

    view raw gistfile1.md hosted with ❤ by GitHub
    15 条回复    2015-04-19 09:33:20 +08:00
    Puteulanus
        1
    Puteulanus  
       2015-04-18 21:01:01 +08:00

    我这儿没问题。。
    gogozs
        2
    gogozs  
    OP
       2015-04-18 21:02:32 +08:00
    @Puteulanus 文件里的内容,不是文件名……
    Puteulanus
        3
    Puteulanus  
       2015-04-18 21:03:57 +08:00
    @gogozs 抱歉没仔细看。。
    qunwang6
        4
    qunwang6  
       2015-04-19 02:44:31 +08:00
    bugcoder
        8
    bugcoder  
       2015-04-19 03:59:10 +08:00

    随便搜点东西,然后在右边的save后面有个加号,点加号,就可以出来下面的选择文件后缀了
    canautumn
        9
    canautumn  
       2015-04-19 05:49:32 +08:00
    除了百度的图片我看不了,其他人没一个理解楼主的问题的。
    楼主还是看看这个吧:
    http://stackoverflow.com/questions/365669/how-can-i-make-spotlight-index-markdown-files
    gogozs
        10
    gogozs  
    OP
       2015-04-19 09:13:03 +08:00
    @qunwang6 我这里不行……
    gogozs
        11
    gogozs  
    OP
       2015-04-19 09:14:10 +08:00
    @canautumn 看到过这帖子,实在不想 hack 啊
    canautumn
        12
    canautumn  
       2015-04-19 09:17:14 +08:00
    @gogozs 提问者也没有hack,他自己是下了一个qlmarkdown的插件,自带启用spotlight对md的索引功能,应该是最简单的方法了。如果哪个app可以自带这个插件就好了,连手动复制粘贴都省了。不过现在还没听说过。
    holong2000
        13
    holong2000  
       2015-04-19 09:17:29 +08:00   ❤️ 1
    @gogozs 可以用spotlight增强应用或者devonthink pro解决。
    gogozs
        14
    gogozs  
    OP
       2015-04-19 09:32:34 +08:00
    @canautumn 看来我用的是另外一个 qlmarkdown…不过这个 gist https://gist.github.com/gereon/3150445 倒是解决了我的问题。
    gogozs
        15
    gogozs  
    OP
       2015-04-19 09:33:20 +08:00
    @holong2000 不过已经解决问题了,还是谢谢啊
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3417 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 10:53 · PVG 18:53 · LAX 02:53 · JFK 05:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.