在Sublime Text中,我经常使用Cmd+P/Ctrl+P在文件之间搜索和跳转。

通常,它会选择临时或缓存的文件,如.scssc或/tmp文件夹中的东西。

是否有一种方法可以限制搜索结果中显示的内容?


当前回答

你也可以通过在Where字段中使用-*/foldername/*语法来排除Find All窗格中的文件夹-例如:

-*/node_modules/*

http://www.sublimetext.com/forum/viewtopic.php?f=2&t=3847&start=10

其他回答

在你的~/Library/Application Support/Sublime Text 2/Packages/User/Preferences中添加并编辑它。sublime-settings文件。

// These files will still show up in the side bar, but won't be included in
// Goto Anything or Find in Files
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],

"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],

对于SublimeText 2,这对我来说非常有效。

当您选择在文件中查找时,在Where输入中指定排除文件夹;

-bower_components/**/*, -dist/**/*, -node_modules/**/*, -tmp/**/*

因此,一个连字符后跟一个排除模式,用于您不想在其中搜索的文件夹。

-folder1/**/*, -folder2/**/*

这将限制你的搜索范围。

你可以通过修改项目设置来排除某些文件模式和文件夹,如下所示:

{
    "folders":
    [
        {
            "path": "src",
            "folder_exclude_patterns": ["backup"]
        },
        {
            "path": "docs",
            "file_exclude_patterns": ["*.css"]
        }
    ]
}

这在项目文档中有描述。

这个解决方案非常适合我:https://superuser.com/a/601270

Find: "something" Where: "<open folders>" // <open folders>" not include hidden folder in sidebar

在sublime text 3 (BLD 3059 Windows)中,我需要限制“在文件夹中查找”功能到某些文件/文件夹,也许是单个文件,

下面的方法对我有用 “where:”框的内容

/C/path/2/project/folder,*.c,*.h,-*/path/not/to/look/in,/C/path/2/specific/file/file.h

如果不使用绝对路径,可以将上述方法与以下符号位置结合使用

<打开文件夹>,<打开文件>,<当前文件>

<open folders>,*.c,*.h,-*/never_this_in_folder/*,<open files>