在Sublime Text中,我经常使用Cmd+P/Ctrl+P在文件之间搜索和跳转。
通常,它会选择临时或缓存的文件,如.scssc或/tmp文件夹中的东西。
是否有一种方法可以限制搜索结果中显示的内容?
在Sublime Text中,我经常使用Cmd+P/Ctrl+P在文件之间搜索和跳转。
通常,它会选择临时或缓存的文件,如.scssc或/tmp文件夹中的东西。
是否有一种方法可以限制搜索结果中显示的内容?
当前回答
对于那些几次你需要限制查找(和替换)到当前目录,这样做:
c/Path/2/Project,-c/Path/2/Project/*/*
重要的位是路径排除模式中的/*/*。在Windows 7 64位上使用Sublime Text 3 build 3083。
其他回答
对于那些几次你需要限制查找(和替换)到当前目录,这样做:
c/Path/2/Project,-c/Path/2/Project/*/*
重要的位是路径排除模式中的/*/*。在Windows 7 64位上使用Sublime Text 3 build 3083。
对于SublimeText 2,这对我来说非常有效。
当您选择在文件中查找时,在Where输入中指定排除文件夹;
-bower_components/**/*, -dist/**/*, -node_modules/**/*, -tmp/**/*
因此,一个连字符后跟一个排除模式,用于您不想在其中搜索的文件夹。
-folder1/**/*, -folder2/**/*
这将限制你的搜索范围。
我认为这些答案中有许多跨越了几个不同版本的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"
],
截图
在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>
在你的~/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"],