1/// This list represents the default file types that ripgrep ships with. In
2/// general, any file format is fair game, although it should generally be
3/// limited to reasonably popular open formats. For other cases, you can add
4/// types to each invocation of ripgrep with the '--type-add' flag.
5///
6/// If you would like to add or improve this list, please file a PR:
7/// <https://github.com/BurntSushi/ripgrep>.
8///
9/// Please try to keep this list sorted lexicographically and wrapped to 79
10/// columns (inclusive).
11#[rustfmt::skip]
12pub(crate) const DEFAULT_TYPES: &[(&[&str], &[&str])] = &[
13 (&["ada"], &["*.adb", "*.ads"]),
14 (&["agda"], &["*.agda", "*.lagda"]),
15 (&["aidl"], &["*.aidl"]),
16 (&["alire"], &["alire.toml"]),
17 (&["amake"], &["*.mk", "*.bp"]),
18 (&["asciidoc"], &["*.adoc", "*.asc", "*.asciidoc"]),
19 (&["asm"], &["*.asm", "*.s", "*.S"]),
20 (&["asp"], &[
21 "*.aspx", "*.aspx.cs", "*.aspx.vb", "*.ascx", "*.ascx.cs",
22 "*.ascx.vb", "*.asp"
23 ]),
24 (&["ats"], &["*.ats", "*.dats", "*.sats", "*.hats"]),
25 (&["avro"], &["*.avdl", "*.avpr", "*.avsc"]),
26 (&["awk"], &["*.awk"]),
27 (&["bat", "batch"], &["*.bat"]),
28 (&["bazel"], &[
29 "*.bazel", "*.bzl", "*.BUILD", "*.bazelrc", "BUILD", "MODULE.bazel",
30 "WORKSPACE", "WORKSPACE.bazel",
31 ]),
32 (&["bitbake"], &["*.bb", "*.bbappend", "*.bbclass", "*.conf", "*.inc"]),
33 (&["brotli"], &["*.br"]),
34 (&["buildstream"], &["*.bst"]),
35 (&["bzip2"], &["*.bz2", "*.tbz2"]),
36 (&["c"], &["*.[chH]", "*.[chH].in", "*.cats"]),
37 (&["cabal"], &["*.cabal"]),
38 (&["candid"], &["*.did"]),
39 (&["carp"], &["*.carp"]),
40 (&["cbor"], &["*.cbor"]),
41 (&["ceylon"], &["*.ceylon"]),
42 (&["clojure"], &["*.clj", "*.cljc", "*.cljs", "*.cljx"]),
43 (&["cmake"], &["*.cmake", "CMakeLists.txt"]),
44 (&["cmd"], &["*.bat", "*.cmd"]),
45 (&["cml"], &["*.cml"]),
46 (&["coffeescript"], &["*.coffee"]),
47 (&["config"], &["*.cfg", "*.conf", "*.config", "*.ini"]),
48 (&["coq"], &["*.v"]),
49 (&["cpp"], &[
50 "*.[ChH]", "*.cc", "*.[ch]pp", "*.[ch]xx", "*.hh", "*.inl",
51 "*.[ChH].in", "*.cc.in", "*.[ch]pp.in", "*.[ch]xx.in", "*.hh.in",
52 ]),
53 (&["creole"], &["*.creole"]),
54 (&["crystal"], &["Projectfile", "*.cr", "*.ecr", "shard.yml"]),
55 (&["cs"], &["*.cs"]),
56 (&["csharp"], &["*.cs"]),
57 (&["cshtml"], &["*.cshtml"]),
58 (&["csproj"], &["*.csproj"]),
59 (&["css"], &["*.css", "*.scss"]),
60 (&["csv"], &["*.csv"]),
61 (&["cuda"], &["*.cu", "*.cuh"]),
62 (&["cython"], &["*.pyx", "*.pxi", "*.pxd"]),
63 (&["d"], &["*.d"]),
64 (&["dart"], &["*.dart"]),
65 (&["devicetree"], &["*.dts", "*.dtsi"]),
66 (&["dhall"], &["*.dhall"]),
67 (&["diff"], &["*.patch", "*.diff"]),
68 (&["dita"], &["*.dita", "*.ditamap", "*.ditaval"]),
69 (&["docker"], &["*Dockerfile*"]),
70 (&["dockercompose"], &["docker-compose.yml", "docker-compose.*.yml"]),
71 (&["dts"], &["*.dts", "*.dtsi"]),
72 (&["dvc"], &["Dvcfile", "*.dvc"]),
73 (&["ebuild"], &["*.ebuild", "*.eclass"]),
74 (&["edn"], &["*.edn"]),
75 (&["elisp"], &["*.el"]),
76 (&["elixir"], &["*.ex", "*.eex", "*.exs", "*.heex", "*.leex", "*.livemd"]),
77 (&["elm"], &["*.elm"]),
78 (&["erb"], &["*.erb"]),
79 (&["erlang"], &["*.erl", "*.hrl"]),
80 (&["fennel"], &["*.fnl"]),
81 (&["fidl"], &["*.fidl"]),
82 (&["fish"], &["*.fish"]),
83 (&["flatbuffers"], &["*.fbs"]),
84 (&["fortran"], &[
85 "*.f", "*.F", "*.f77", "*.F77", "*.pfo",
86 "*.f90", "*.F90", "*.f95", "*.F95",
87 ]),
88 (&["fsharp"], &["*.fs", "*.fsx", "*.fsi"]),
89 (&["fut"], &["*.fut"]),
90 (&["gap"], &["*.g", "*.gap", "*.gi", "*.gd", "*.tst"]),
91 (&["gn"], &["*.gn", "*.gni"]),
92 (&["go"], &["*.go"]),
93 (&["gprbuild"], &["*.gpr"]),
94 (&["gradle"], &[
95 "*.gradle", "*.gradle.kts", "gradle.properties", "gradle-wrapper.*",
96 "gradlew", "gradlew.bat",
97 ]),
98 (&["graphql"], &["*.graphql", "*.graphqls"]),
99 (&["groovy"], &["*.groovy", "*.gradle"]),
100 (&["gzip"], &["*.gz", "*.tgz"]),
101 (&["h"], &["*.h", "*.hh", "*.hpp"]),
102 (&["haml"], &["*.haml"]),
103 (&["hare"], &["*.ha"]),
104 (&["haskell"], &["*.hs", "*.lhs", "*.cpphs", "*.c2hs", "*.hsc"]),
105 (&["hbs"], &["*.hbs"]),
106 (&["hs"], &["*.hs", "*.lhs"]),
107 (&["html"], &["*.htm", "*.html", "*.ejs"]),
108 (&["hy"], &["*.hy"]),
109 (&["idris"], &["*.idr", "*.lidr"]),
110 (&["janet"], &["*.janet"]),
111 (&["java"], &["*.java", "*.jsp", "*.jspx", "*.properties"]),
112 (&["jinja"], &["*.j2", "*.jinja", "*.jinja2"]),
113 (&["jl"], &["*.jl"]),
114 (&["js"], &["*.js", "*.jsx", "*.vue", "*.cjs", "*.mjs"]),
115 (&["json"], &["*.json", "composer.lock", "*.sarif"]),
116 (&["jsonl"], &["*.jsonl"]),
117 (&["julia"], &["*.jl"]),
118 (&["jupyter"], &["*.ipynb", "*.jpynb"]),
119 (&["k"], &["*.k"]),
120 (&["kotlin"], &["*.kt", "*.kts"]),
121 (&["lean"], &["*.lean"]),
122 (&["less"], &["*.less"]),
123 (&["license"], &[
124 // General
125 "COPYING", "COPYING[.-]*",
126 "COPYRIGHT", "COPYRIGHT[.-]*",
127 "EULA", "EULA[.-]*",
128 "licen[cs]e", "licen[cs]e.*",
129 "LICEN[CS]E", "LICEN[CS]E[.-]*", "*[.-]LICEN[CS]E*",
130 "NOTICE", "NOTICE[.-]*",
131 "PATENTS", "PATENTS[.-]*",
132 "UNLICEN[CS]E", "UNLICEN[CS]E[.-]*",
133 // GPL (gpl.txt, etc.)
134 "agpl[.-]*",
135 "gpl[.-]*",
136 "lgpl[.-]*",
137 // Other license-specific (APACHE-2.0.txt, etc.)
138 "AGPL-*[0-9]*",
139 "APACHE-*[0-9]*",
140 "BSD-*[0-9]*",
141 "CC-BY-*",
142 "GFDL-*[0-9]*",
143 "GNU-*[0-9]*",
144 "GPL-*[0-9]*",
145 "LGPL-*[0-9]*",
146 "MIT-*[0-9]*",
147 "MPL-*[0-9]*",
148 "OFL-*[0-9]*",
149 ]),
150 (&["lilypond"], &["*.ly", "*.ily"]),
151 (&["lisp"], &["*.el", "*.jl", "*.lisp", "*.lsp", "*.sc", "*.scm"]),
152 (&["lock"], &["*.lock", "package-lock.json"]),
153 (&["log"], &["*.log"]),
154 (&["lua"], &["*.lua"]),
155 (&["lz4"], &["*.lz4"]),
156 (&["lzma"], &["*.lzma"]),
157 (&["m4"], &["*.ac", "*.m4"]),
158 (&["make"], &[
159 "[Gg][Nn][Uu]makefile", "[Mm]akefile",
160 "[Gg][Nn][Uu]makefile.am", "[Mm]akefile.am",
161 "[Gg][Nn][Uu]makefile.in", "[Mm]akefile.in",
162 "*.mk", "*.mak"
163 ]),
164 (&["mako"], &["*.mako", "*.mao"]),
165 (&["man"], &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
166 (&["markdown", "md"], &[
167 "*.markdown",
168 "*.md",
169 "*.mdown",
170 "*.mdwn",
171 "*.mkd",
172 "*.mkdn",
173 "*.mdx",
174 ]),
175 (&["matlab"], &["*.m"]),
176 (&["meson"], &["meson.build", "meson_options.txt", "meson.options"]),
177 (&["minified"], &["*.min.html", "*.min.css", "*.min.js"]),
178 (&["mint"], &["*.mint"]),
179 (&["mk"], &["mkfile"]),
180 (&["ml"], &["*.ml"]),
181 (&["motoko"], &["*.mo"]),
182 (&["msbuild"], &[
183 "*.csproj", "*.fsproj", "*.vcxproj", "*.proj", "*.props", "*.targets",
184 "*.sln",
185 ]),
186 (&["nim"], &["*.nim", "*.nimf", "*.nimble", "*.nims"]),
187 (&["nix"], &["*.nix"]),
188 (&["objc"], &["*.h", "*.m"]),
189 (&["objcpp"], &["*.h", "*.mm"]),
190 (&["ocaml"], &["*.ml", "*.mli", "*.mll", "*.mly"]),
191 (&["org"], &["*.org", "*.org_archive"]),
192 (&["pants"], &["BUILD"]),
193 (&["pascal"], &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
194 (&["pdf"], &["*.pdf"]),
195 (&["perl"], &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
196 (&["php"], &[
197 // note that PHP 6 doesn't exist
198 // See: https://wiki.php.net/rfc/php6
199 "*.php", "*.php3", "*.php4", "*.php5", "*.php7", "*.php8",
200 "*.pht", "*.phtml"
201 ]),
202 (&["po"], &["*.po"]),
203 (&["pod"], &["*.pod"]),
204 (&["postscript"], &["*.eps", "*.ps"]),
205 (&["prolog"], &["*.pl", "*.pro", "*.prolog", "*.P"]),
206 (&["protobuf"], &["*.proto"]),
207 (&["ps"], &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]),
208 (&["puppet"], &["*.epp", "*.erb", "*.pp", "*.rb"]),
209 (&["purs"], &["*.purs"]),
210 (&["py", "python"], &["*.py", "*.pyi"]),
211 (&["qmake"], &["*.pro", "*.pri", "*.prf"]),
212 (&["qml"], &["*.qml"]),
213 (&["r"], &["*.R", "*.r", "*.Rmd", "*.Rnw"]),
214 (&["racket"], &["*.rkt"]),
215 (&["raku"], &[
216 "*.raku", "*.rakumod", "*.rakudoc", "*.rakutest",
217 "*.p6", "*.pl6", "*.pm6"
218 ]),
219 (&["rdoc"], &["*.rdoc"]),
220 (&["readme"], &["README*", "*README"]),
221 (&["reasonml"], &["*.re", "*.rei"]),
222 (&["red"], &["*.r", "*.red", "*.reds"]),
223 (&["rescript"], &["*.res", "*.resi"]),
224 (&["robot"], &["*.robot"]),
225 (&["rst"], &["*.rst"]),
226 (&["ruby"], &[
227 // Idiomatic files
228 "config.ru", "Gemfile", ".irbrc", "Rakefile",
229 // Extensions
230 "*.gemspec", "*.rb", "*.rbw"
231 ]),
232 (&["rust"], &["*.rs"]),
233 (&["sass"], &["*.sass", "*.scss"]),
234 (&["scala"], &["*.scala", "*.sbt"]),
235 (&["sh"], &[
236 // Portable/misc. init files
237 ".login", ".logout", ".profile", "profile",
238 // bash-specific init files
239 ".bash_login", "bash_login",
240 ".bash_logout", "bash_logout",
241 ".bash_profile", "bash_profile",
242 ".bashrc", "bashrc", "*.bashrc",
243 // csh-specific init files
244 ".cshrc", "*.cshrc",
245 // ksh-specific init files
246 ".kshrc", "*.kshrc",
247 // tcsh-specific init files
248 ".tcshrc",
249 // zsh-specific init files
250 ".zshenv", "zshenv",
251 ".zlogin", "zlogin",
252 ".zlogout", "zlogout",
253 ".zprofile", "zprofile",
254 ".zshrc", "zshrc",
255 // Extensions
256 "*.bash", "*.csh", "*.ksh", "*.sh", "*.tcsh", "*.zsh",
257 ]),
258 (&["slim"], &["*.skim", "*.slim", "*.slime"]),
259 (&["smarty"], &["*.tpl"]),
260 (&["sml"], &["*.sml", "*.sig"]),
261 (&["solidity"], &["*.sol"]),
262 (&["soy"], &["*.soy"]),
263 (&["spark"], &["*.spark"]),
264 (&["spec"], &["*.spec"]),
265 (&["sql"], &["*.sql", "*.psql"]),
266 (&["stylus"], &["*.styl"]),
267 (&["sv"], &["*.v", "*.vg", "*.sv", "*.svh", "*.h"]),
268 (&["svelte"], &["*.svelte"]),
269 (&["svg"], &["*.svg"]),
270 (&["swift"], &["*.swift"]),
271 (&["swig"], &["*.def", "*.i"]),
272 (&["systemd"], &[
273 "*.automount", "*.conf", "*.device", "*.link", "*.mount", "*.path",
274 "*.scope", "*.service", "*.slice", "*.socket", "*.swap", "*.target",
275 "*.timer",
276 ]),
277 (&["taskpaper"], &["*.taskpaper"]),
278 (&["tcl"], &["*.tcl"]),
279 (&["tex"], &["*.tex", "*.ltx", "*.cls", "*.sty", "*.bib", "*.dtx", "*.ins"]),
280 (&["texinfo"], &["*.texi"]),
281 (&["textile"], &["*.textile"]),
282 (&["tf"], &[
283 "*.tf", "*.auto.tfvars", "terraform.tfvars", "*.tf.json",
284 "*.auto.tfvars.json", "terraform.tfvars.json", "*.terraformrc",
285 "terraform.rc", "*.tfrc", "*.terraform.lock.hcl",
286 ]),
287 (&["thrift"], &["*.thrift"]),
288 (&["toml"], &["*.toml", "Cargo.lock"]),
289 (&["ts", "typescript"], &["*.ts", "*.tsx", "*.cts", "*.mts"]),
290 (&["twig"], &["*.twig"]),
291 (&["txt"], &["*.txt"]),
292 (&["typoscript"], &["*.typoscript", "*.ts"]),
293 (&["usd"], &["*.usd", "*.usda", "*.usdc"]),
294 (&["v"], &["*.v", "*.vsh"]),
295 (&["vala"], &["*.vala"]),
296 (&["vb"], &["*.vb"]),
297 (&["vcl"], &["*.vcl"]),
298 (&["verilog"], &["*.v", "*.vh", "*.sv", "*.svh"]),
299 (&["vhdl"], &["*.vhd", "*.vhdl"]),
300 (&["vim"], &[
301 "*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
302 ]),
303 (&["vimscript"], &[
304 "*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
305 ]),
306 (&["vue"], &["*.vue"]),
307 (&["webidl"], &["*.idl", "*.webidl", "*.widl"]),
308 (&["wgsl"], &["*.wgsl"]),
309 (&["wiki"], &["*.mediawiki", "*.wiki"]),
310 (&["xml"], &[
311 "*.xml", "*.xml.dist", "*.dtd", "*.xsl", "*.xslt", "*.xsd", "*.xjb",
312 "*.rng", "*.sch", "*.xhtml",
313 ]),
314 (&["xz"], &["*.xz", "*.txz"]),
315 (&["yacc"], &["*.y"]),
316 (&["yaml"], &["*.yaml", "*.yml"]),
317 (&["yang"], &["*.yang"]),
318 (&["z"], &["*.Z"]),
319 (&["zig"], &["*.zig"]),
320 (&["zsh"], &[
321 ".zshenv", "zshenv",
322 ".zlogin", "zlogin",
323 ".zlogout", "zlogout",
324 ".zprofile", "zprofile",
325 ".zshrc", "zshrc",
326 "*.zsh",
327 ]),
328 (&["zstd"], &["*.zst", "*.zstd"]),
329];
330
331#[cfg(test)]
332mod tests {
333 use super::DEFAULT_TYPES;
334
335 #[test]
336 fn default_types_are_sorted() {
337 let mut names = DEFAULT_TYPES.iter().map(|(aliases, _)| aliases[0]);
338 let Some(mut previous_name) = names.next() else {
339 return;
340 };
341 for name in names {
342 assert!(
343 name > previous_name,
344 r#""{}" should be sorted before "{}" in `DEFAULT_TYPES`"#,
345 name,
346 previous_name
347 );
348 previous_name = name;
349 }
350 }
351}
352