Syntax reference

This page provides detailed information on the supported filters, operators, syntax options, and keyboard shortcuts for Code Search.

Supported filters

The following table lists the filters you can use when searching code.

Filter Other options Description Example
case:yes case:y Make the search case sensitive. By default, searches are not case sensitive.

If you are grouping multiple search terms, this filter is inherited by all child groups.
case:yes Hello World
class: Search for a class name. class:MainClass
comment: Search within comments. comment:bug
content: Search only for file contents. This excludes filenames. content:hello
file: filepath:
path:
f:
Search for a file by filename or path. file:test.js
function: func: Search for a function name. function:print
lang: language: Search for results by using a specific language. lang:java test
pcre:yes Use Perl compatible regular expressions.

Useful for searching across lines.
pcre:yes @Provides\s+double
symbol: Search for a specific symbol. symbol:immutable
usage: Search while excluding comments and string literals. usage:map

lang options

The table below lists the commonly used programming languages supported by the lang: filter. Where applicable, an alias can be used for the value.

Language lang: value Aliases
C++ c++ cpp, cc, cxx
C c
Java java
Kotlin kotlin kt,kts
Python python py
JavaScript javascript js
Go go golang
JSON json
HTML html angular
Objective-C++ objectivec++
Objective-C objectivec objc
Markdown markdown md
AppleScript applescript
C# c# csharp
CSS css
CSV csv
curl curl
Dart dart
Django django
JSP jsp
Perl perl
PHP php
PowerShell powershell
Ruby ruby
shell shell bash, sh
SHTML shtml
SQL sql
Swift swift
Tcl tcl
XML xml
XSLT xslt
YAML yaml

Supported operators

The following table lists the operators you can use when searching code.

Operator Description
AND Logical `AND` operator. See Using the AND operator for more information.
OR Logical `OR` operator. See Using the OR operator for more information.

Additional syntax options

The following additional syntax options are supported for searching code.

Option Description
(search_expression) Groups multiple terms together. See Grouping search terms for more information.
- Excludes the term from search results.
\ Escapes special characters such as ., \, or (.
"search_expression" Perform a literal search without interpreting the search query as a regular expression.

Supported keyboard shortcuts

To see the keyboard shortcuts available in Code Search, type ?.

The following table lists the keyboard shortcuts you can use when searching code.

Key(s) Action
h Show the file's revision history.
q Toggle the bottom panel.
b Show or hide the blame layer.
f Show the find bar.
/ Change focus to the search box.
o Change focus to the outline browser.
t Change focus to the directory tree.
l Opens the Links drop-down.
lp Copies the file path in the Links drop-down.
lh Copies the link to the HEAD version of the file in the Links drop-down.
lr Copies the link to the current version of the file and the current line in the Links drop-down.
. While in the search box, search for code or files in the current directory.
j Select the next result in the search results.
k Select the previous result in the search results.
x Show cross references for symbols.