Prevent Sublime Text from including .sublime

Here is my Preferences.sublime-settings file:

{
    "bold_folder_labels": true,
    "highlight_line": true,
    "ignored_packages":
    [
        "Vintage"
    ],
    "remember_open_files": true,
    "folders":
    [
        {
         "file_exclude_patterns": ["*.sublime-workspace"]
        }
    ]
}

When I search all of my open files and folders in the sidebar (cmd-shift-f) I still get search results including workspace files which live in one of the directories which I have open. For instance, if I have ~/foo open and there's a file ~/foo/bar/hello.sublime-workspace , it gets included in the search results.

How do I get Sublime to never include .sublime-workspace files in my searches?


According to the comments here it looks like you have two possible solutions:

  • Use a negated pattern in the "Where:" field of "Find in Files...": -*.sublime-workspace
  • In your settings file in the "folders" section, add "binary_file_patterns": ["*.sublime-workspace"]

  • Edit

    Actually, you may just need to specify a "path" for your "file_exclude_patterns" :

    "folders":
    [
        {
            "path": "./",
            "file_exclude_patterns": [".sublime-workspace"]
        }
    ]
    

    From http://www.sublimetext.com/docs/2/projects.html:

    Each folder must have a path , and may optionally have a folder_exclude_patterns and file_exclude_patterns setting.


    You can add a filter by appending " ,-*.sublime-workspace " to your directory next to Where:

    For example, set Where to

    <project>,-*.sublime-workspace
    

    to search all your project directories, or

    c:mydir,-*.sublime-workspace
    

    to search a specific directory.


    This answers the question title but for a problem that can come up in project-level configuration.

    It's a reported bug that binary_file_patterns does not work on a per-project basis. Except it sometimes does. In any case, this worked for me when I moved the workspace exclusion, for a project, from binary_file_patterns to file_exclude_patterns.

    Another issue you may be unaware of is that if you open the directory with subl . , it does not load the project. You need to go to "Sublime > Project" and "open project" for the settings to take effect. Yes, this is terrible.

    链接地址: http://www.djcxy.com/p/74696.html

    上一篇: 在ActionBar / ActionBarSherlock中自定义图片而不是徽标

    下一篇: 防止崇高文本包含.sublime