Documentation

Search

Typst gives you the tools to search through the files in your project and find exactly what you're looking for. You can search through the currently open file, all files, or a subset of files, configure case sensitivity and word boundaries, and use regular expressions.

Searching in the current file

To search in the current file, press Ctrl/Cmd+F or select "Edit > Search and replace" from the menu bar. A search panel opens at the bottom of the editor. As you enter text in the textbox labelled "Find", Typst continually searches through the file and highlights matches with a yellow background. If you press Ctrl/Cmd+F while you have text selected, the search box will be prepopulated with that text.

Repeatedly press Enter or F3 to cycle through all matches in the file. If you hold shift while pressing Enter or F3, you will instead cycle backwards. You can also use the Arrow down Down and Arrow up Up buttons to navigate through the matches. With the Select all button, you can select all matches in the editor.

The search box for the current file. Searches for the word 'glacier' and next to it are buttons to jump to the previous and next match, select all matches, match case-sensitively, match whole words, and search with regular expressions. Below, the replacement text 'vulcano' and buttons to replace one or all matches.

Next to the "Find" input, you'll find three buttons to further narrow down your search:

Below the "Find" input, there is a "Replace" input. Enter text and then press Replace one "Replace one" or Replace all "Replace all" to replace the current or all matches with what you've entered. When searching with regular expressions, you can also use dollar replacement syntax (e.g. $1) to reuse text matched by capture groups.

You can close the search box by clicking the Close Close button or pressing Escape.

Searching in all files

As your project grows larger, you'll start splitting it up into multiple files. When you're searching for something in your project, but aren't sure in which file it is, or when you know that there will be matches across multiple files, the search side panel comes in handy.

You can open the search panel by clicking the magnifying glass button in the sidebar. Like the search box, the search panel will display two text inputs, one to search and one to replace. You can also use the "Case sensitive", "Whole word", and "Regex" options you already know from search in the current file.

When the search input is focused, you can start navigating through the matches by pressing the down and up arrow keys. To jump to a specific match, click on it or press Enter after selecting it with the arrow keys.

The search panel for all files. Searches for the word 'glacier' and next to it are buttons to match case-sensitively, match whole words, search regular expressions, and filter which files to include. Below, the replacement text 'vulcano' and a button to replace all instances. Even below, the matches for all files and buttons to replace per file and per match.

Replacing across files

When replacing across files, you have multiple options. You can press the Replace all "Replace all" button next to the replacement input to perform the replacement everywhere at once. Make sure everything is correct before clicking this button as the action is not reversible across all files at once. (You can still press Ctrl/Cmd+Z in each file individually.)

Alternatively, you can replace all matches in a particular file (by clicking the replacement button next to the file name) or just a single match (by clicking the replacement button next to that match).

File filtering

Sometimes, you may want to search in just part of your project. Typst's search has built-in support for file filtering. Click the Folder Folder button to reveal a third input field. You can use this input to filter in which files and folders you want to search. The input accepts a glob pattern. A file path must match this pattern for the file to be considered during search. Most letters in a glob pattern are considered as-is and must match exactly. That said, there are a few special characters:

Here are some examples of valid glob patterns:

Line numbers

By default, Typst will show a line number below each match. You can disable this by navigating to the settings side panel and unchecking "Show line numbers in search results".