Documentation TOP File Patterns
Various features in Sublime Text use file patterns. These patterns are used to match against file/directory names and paths. They are similar in functionality to shell glob patterns, but have some unique behavior.
Basic Syntax
File patterns allow two matching operators:
*: matches zero or more characters, except/?: matches exactly one character, except/
Neither character classes, [abc], nor the globstar operator, **, from Bash are supported.
Examples
- The pattern
abcwill matchabcbut notabcd - The pattern
a?cwill matchabcbut notac - The pattern
a*cwill matchabc,acandabdc
Path Rules
When / is not present in a pattern, it is only compared against the file
or directory name and only the basic syntax applies. When a / is included
in a pattern, it changes the behavior to:
- The pattern is matched against the entire file or directory path
*will match/characters- If the pattern ends in
/it will be treated as a directory pattern, and will match both a directory with that name and 4066 any contained files or subdirectories - If a pattern begins with a single
/, it will be compared as an absolute path - If pattern begins with
//, it will be compared as a relative path from the project root
4066
Examples
- The pattern
mydir/onewill match/parent/mydir/one,/mydir/oneand/mydir/one/sub - The pattern
mydir/twowill match/parent/mydir/twoand/parent/mydir/two_sub
<4066
- The pattern mydir/two will match /parent/mydir/two but not
/parent/mydir/two_sub
4066
- The pattern /mydir/three will match /mydir/three but not
/nested/mydir/three
- The pattern mydir/three/ will match /parent/mydir/three/sub but not
/parent/mydir/three
<4066
- The pattern mydir/four/ will match /parent/mydir/four and
/parent/mydir/four/sub
4066
- The pattern //mydir/five will match /project1/mydir/five and
/project2/mydir/five but not /project1/nested/mydir/five
4066
Uses
File patterns are used in:
- Find in Files panel Where input
- Various settings
“folder_exclude_patterns”: Settings and Projects“folder_include_patterns”: Projects“file_exclude_patterns”: Settings and Projects“file_include_patterns”: Projects“binary_file_patterns”: Settings and Projects“index_exclude_patterns”: Settings and Projects“index_include_patterns”: Settings and Projects
Sublime Merge
