Navigate a project
Once you can edit a region and repeat changes, the next step is finding the right region in a larger project. Use filenames to find files, text search to find occurrences, and symbols to find code definitions.
Open a project from its root directory:
ms .
Find a file or a piece of code
Choose the picker based on what you know:
| What you know | Where to start |
|---|---|
| Part of a filename or path | Space f, then type part of the path |
| A file is already open | Space b to choose its buffer |
| Some text, but not its file | Space /, then type a regular expression |
| A function or type in the current file | Space s for file symbols |
| A symbol elsewhere in the project | Space S for workspace symbols |
For example, press Space /, type TODO, and inspect the preview before
pressing Enter on a result. To limit the results to Rust paths, use
TODO %p .rs. Path filters use fuzzy matching; .rs$ requires that suffix.
See Pickers for more filters.
File and workspace symbols use a language server when available, with syntax queries as a fallback. Check Language servers for the setup and available language support.
Follow a call and come back
While reading a function, you may want to inspect a call without losing your place:
- Press
Ctrl-sin normal mode to save your location in the jumplist. This saves a location, not the file; use:writeto save text. - Put the cursor on the called function and press
gdto go to its definition when a language server provides it. Otherwise, useSpace /to search for its name and pressEnteron a result. - At the definition, use
Space kfor language-server documentation, or textobjects to select and read the function. - Press
Ctrl-oto step back through jumps until you return to the caller.Ctrl-isteps forward again.
Use ga to switch between the two most recently accessed buffers. Use the
jumplist when you need to return to a position, including a
position within the same file.
Keep two places visible
To keep the caller visible while reading another file:
- Open a file, symbol, or search picker and choose the result.
- Press
Ctrl-vto open it in a vertical split. - Use
Ctrl-w handCtrl-w lto move between the left and right views. - Press
Ctrl-w qto close the focused view when you are finished.
Closing a view can leave its buffer open. Space b finds it again. Both views
show the same edits if they display the same buffer; they are not independent
copies. See Files, buffers, and splits.
Keep a list of places to visit
For a task such as reviewing TODOs, press Ctrl-q in the search picker to
collect the matching locations in the quicklist. Close the picker with Esc,
then use ]q and [q to visit the next and previous locations. Space q opens
the list.
Use a quicklist for a set of results you intend to work through. Use Space '
to reopen the last picker when you want to refine its query or browse again.
See Quicklist for more ways to collect locations.
Previous: Repeat and combine edits · Next: Review and stage changes