Searching
Fern has two search modes:
- a vault-wide full-text search for finding notes
- an in-note search for navigating within an open file
Both support the same structured query operators.
Vault search
Press / from View or Normal mode to open the search modal.
Type a query and Fern searches the full text of every note in your vault. Results update as you type and are ranked by relevance. Regular expressions are supported.
| Key | Action |
|---|---|
/ |
Open vault search |
j / Down |
Move to next result |
k / Up |
Move to previous result |
Enter |
Open the selected note |
Esc |
Close search without opening |
When you open a result, Fern jumps to the note and highlights every match.
Use n and N to jump forward and backward through the highlights.
Searching from a selection
In Normal mode, select text with v or V, then press s to open vault
search pre-filled with the selected text.
In-note search
To search within the currently open note, use the command bar:
:/<term>
Press Enter to confirm. Fern highlights every match in the note and moves
the cursor to the first one.
| Key | Action |
|---|---|
n |
Jump to next match |
N |
Jump to previous match |
Esc |
Clear highlights |
In-note search supports regular expressions. For example, to find any line starting with a checkbox:
:/^\s*- \[
Search operators
Both vault search and in-note search support structured query operators. Operators can be combined freely in a single query.
Text matching
| Syntax | Matches |
|---|---|
word |
Lines containing the word (case-insensitive) |
"multi word phrase" |
Lines containing the exact phrase |
-word |
Lines that do NOT contain the word |
-"exact phrase" |
Lines that do NOT contain the phrase |
Boolean operators
Use OR or XOR between terms or groups to broaden or narrow results.
| Syntax | Matches |
|---|---|
pikachu OR squirtle |
Lines matching either term |
pikachu XOR squirtle |
Lines matching exactly one of the terms (not both) |
You can combine multiple terms in each group:
"gym leaders" OR "team rocket"
meowth -wild XOR "team rocket"
Note: OR and XOR cannot be mixed in the same query. Use one or the other.
Task operators
| Syntax | Matches |
|---|---|
task: |
Any checkbox item (- [ ], - [x], etc.) |
task-todo: |
Checkbox items in the "todo" state |
task-done: |
Checkbox items in the "done" state |
task-todo:text |
Todo items whose text also contains "text" |
The symbols used for task-todo: and task-done: follow your checkbox_todo
and checkbox_done settings. See Configuring Fern.
Tag operator
| Syntax | Matches |
|---|---|
tag:pokemon |
Lines containing #pokemon |
tag:#pokemon |
Same as above (the # prefix is optional) |
Scope operators
Scope operators restrict matches to a specific structural context within a note if it contains all the given terms passed. They expect a parenthesised list of terms.
| Syntax | Matches |
|---|---|
section:(terms) |
All lines within any heading section |
block:(terms) |
All lines within any paragraph or list block that contains all the given terms |
subtask:(terms) |
Subtask lines nested under any checkbox item matching the given terms |
Terms inside () follow the same negation rules: prefix with - to exclude.
Examples:
section:(project deadline)
Finds all lines in any section whose heading area contains both "project" and "deadline".
block:(error -expected)
Finds all lines in any block that contains "error" but not "expected".
subtask:(sprint backlog) task-todo:
Finds todo subtasks nested under tasks that mention "sprint" and "backlog".
Find and replace
To search and replace within the current note, use the command bar with vim-style substitute syntax:
:s/pattern/replacement/
| Command | Effect |
|---|---|
:s/old/new/ |
Replace the first occurrence of old per line |
:s/old/new/g |
Replace all occurrences in the document |
:s/old/new/c |
Interactively confirm each replacement |
:s/old/new/gc |
Interactively confirm each replacement (all occurrences) |
:%s/old/new/g |
Same as above (vim-style whole-file prefix, optional) |
The pattern is case-insensitive. The replacement is literal text.
During an interactive session (c flag), the status bar shows the current
match position and the following keys are active:
| Key | Action |
|---|---|
y |
Replace this occurrence and advance |
n |
Skip this occurrence and advance |
a |
Replace all remaining occurrences at once |
q / Esc |
Cancel and leave the document unchanged |
Each confirmed replacement is a separate undo entry. Replacing all at once
(a or without the c flag) is a single undo entry.
Tips
- Vault search and in-note search share the same
n/Nnavigation keys. After opening a vault search result,nandNcontinue to navigate the matches from your query inside that note. - To search across a specific subfolder, use a path prefix in your regex:
community/.*meetingwill only match notes insidecommunity/. - The search index is updated automatically whenever you save a note.
- Operators can be mixed:
tag:work task-todo: section:(Q3)finds todo items tagged#workinside any section containing "Q3".
Next: Linking Notes