在Sublime Text中,我经常使用Cmd+P/Ctrl+P在文件之间搜索和跳转。
通常,它会选择临时或缓存的文件,如.scssc或/tmp文件夹中的东西。
是否有一种方法可以限制搜索结果中显示的内容?
在Sublime Text中,我经常使用Cmd+P/Ctrl+P在文件之间搜索和跳转。
通常,它会选择临时或缓存的文件,如.scssc或/tmp文件夹中的东西。
是否有一种方法可以限制搜索结果中显示的内容?
当前回答
在你的~/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"],
其他回答
对于那些几次你需要限制查找(和替换)到当前目录,这样做:
c/Path/2/Project,-c/Path/2/Project/*/*
重要的位是路径排除模式中的/*/*。在Windows 7 64位上使用Sublime Text 3 build 3083。
我认为这些答案中有许多跨越了几个不同版本的Sublime Text,以下是我如何在Mac上使用Sublime Text 3做到这一点。
打开Sublime Text > Preferences > Settings - User菜单 编辑file_exclude_patterns和folder_exclude_patterns值以忽略查找工具中的文件和/或文件夹
例子
"file_exclude_patterns":
[
".svn",
".git",
".hg",
".md",
".txt",
".DS_Store"
],
"folder_exclude_patterns":
[
"node_modules",
"bower_components",
".svn",
".git",
".hg",
"CVS",
"deprecated",
"cache"
],
截图
你也可以通过在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/**/*
这将限制你的搜索范围。