Skip to main content

Search

Rune gives you several ways to find code, each suited to a different question. This guide covers the structural search built on tree-sitter (jump to a definition in the current file, or across the workspace) and the fuzzy finders for files and symbols. It also points you at the two neighboring tools: semantic symbol search for first-class languages, and the location picker for turning any command's output into a jump list.

At a glance:

You want toCommandPreset keybinding
Jump to a function in the current filejumptoast<alt-f>
Jump to a variable in the current filejumptoast<alt-x>
Jump to a type in the current filejumptoast<alt-s>
Find a function definition anywhere in the workspacesearchfuncnot bound by selected preset
Find a variable definition anywhere in the workspacesearchvarnot bound by selected preset
Find a type definition anywhere in the workspacesearchtypenot bound by selected preset
Search a file by namesearchfile<meta-o>
Search file contents across the workspacesearchtext<shift-meta-f>
Jump to an arbitrary symbol's definitionlsp definition <symbol><alt-shift-d>
Open an arbitrary symbol's documentationlsp hover <symbol><alt-shift-t>
List an arbitrary symbol's referenceslsp references <symbol><alt-shift-r>
Turn any grep/rg output into a jump listlocationpicker <program>(define your own)

Structural search and navigation

Every language package ships a tree-sitter grammar and query files, so Rune has a real parse tree for the file instead of plain text. Two commands query that tree using tree-sitter patterns:

  • jumptoast jumps the cursor to a node in the current file. Its syntax is jumptoast <query> <captures> <name>, where <query> is a query file (such as locals.scm), <captures> is one or more capture names joined by |, and <name> selects the matching line.
  • searchast runs the same kind of query across every file in the workspace and presents the matches in a fuzzy picker. Its syntax is searchast <query> <captures>.

The editor presets wire the common forms to keys. The tables below follow the preset selected at the top of the page.

Jump within the current file

The jumptoast bindings prefill the prompt with the command and leave it open, so you can fuzzy search the functions, variables, or types in the file and jump to the one you pick:

KeyJumps to
<alt-f>a function or method
<alt-x>a variable
<alt-s>a type

Search across the workspace

To search every file, use the searchast aliases. You can type each alias in the command prompt and bind it yourself when the selected preset leaves it unbound:

KeyAliasSearches for
not bound by selected presetsearchfuncfunctions and methods
not bound by selected presetsearchvarvariables
not bound by selected presetsearchtypetypes

They open a fuzzy picker over every matching definition in the workspace; selecting a result jumps you straight to it. All of these query locals.scm filtered by the local.definition.function/.method, local.definition.var, and local.definition.type captures.

A language package supplies the query files these commands read, so structural search lights up for any installed language. See Supported Languages for the full list and how packages install.

The fuzzy file and symbol finders

The file finder (searchfile) and symbol finder are floating surfaces: they appear on top of your windows, take focus while open, and get out of the way when you are done, without disturbing the windows underneath. Type to fuzzy-filter, move through the matches, and press <enter> to open the selection in the window you were last working in.

The fuzzy match is deterministic, so the shortest sequence that singles out a name always ranks it first. Spend a few seconds finding that sequence once and it becomes reflex, the same way the command prompt's fuzzy finder works for commands.

Search files

searchfile (<meta-o>) opens the file finder: type to fuzzy-filter files by name across the workspace and press <enter> to open the match.

Search text

searchtext (<shift-meta-f>) searches file contents across the workspace and presents the matches in a fuzzy picker, jumping you to the line you pick.

For first-class languages such as Go, Rune adds language-server symbol search on top of the structural tools. Instead of matching the parse tree, it queries the language server, so you can jump to a definition, list references, or find implementations of a symbol by name with full code intelligence. See Query any symbol by name for the commands and bindings.

Turn command output into a jump list

When the thing you want to find is best expressed as a shell command, the location picker runs any program that prints path:line:col locations (grep, git grep, rg, awk, or your own script) and presents every line as a fuzzy-filterable entry with a live preview. It is the bridge between Rune's structured search and the text-search tools you already know.

Ask Rune Agent