Skip to content

Finding code

Find a file, search the repository, search one file, or narrow a panel.

stage has four ways to find something. They look similar and they answer different questions.

Question Tool Keys
Where is that file? Explorer E, then /
Where is that text, in the repository? Search ctrl+g
Where is that text, in this file? Find in view / in the main pane
Show me less of this list Panel filter / in a panel

Press E to open the explorer. The explorer shows the whole working tree, and not only the files that you changed. Press E again to go back to the git panel that you used before.

The explorer and the search are the two panels of one window. Press ] or [ to move between them. You can also click the name of a panel.

Keys Action
enter Open the file, or expand the directory
l Expand the directory, then move into it
h Collapse the directory, or move out to the parent
e Open the file in your editor
- / = Collapse or expand everything
ctrl+v Change what the main pane shows
] / [ Move to the search, and back
E Go back to the git panel that you used before
1-5 Go to a git panel

Files that git ignores are shown in grey.

h and l work one level at a time, as they do in a vim file explorer. The arrow keys and do the same. enter is different: it is one key for both directions.

l expands the directory under the cursor. A second l moves into it. On a file, l opens the file in the main pane.

h collapses the directory under the cursor. From a file, or from a directory that is already collapsed, h moves to the parent directory and collapses it. h walks back out of the tree that l walked into.

e opens the file under the cursor in your editor. The files panel shows only the files that you changed, so the explorer is the way to edit a clean file.

When the explorer shows the tree of a commit or a branch (U in a git panel), e refuses. The file on screen is the copy from that commit, and your editor would open the file on disk. Press esc to go back to the working tree.

  1. Press /. The filter input takes the keys.
  2. Type part of the name.
  3. Press enter on the file you want.
The list narrows on every keystroke. The dot in patch.ts is optional.

The match is a subsequence, so patchts finds src/core/patch.ts. The search also accepts a small number of wrong letters, so wathcer finds watcher.ts.

Press ctrl+g to open the search. Other editors put this search behind a global search command. The search is the second panel of the explorer window, so ] and [ also reach it.

  1. Press / in the search. The input takes the keys.
  2. Type the text you want.
  3. Press j or k to move through the results.
  4. If the input is open, press esc first. An input takes every key.
  5. Press ctrl+g to go back to the git panel that you used before. Press 1-5 to go to a different panel.

The results change while you type. stage waits for a short pause before it runs the search. A fast typist gets one search, and not one search per letter. The panel shows the first 100 results.

The main pane previews the file of the result under the cursor, and it highlights the line that matched.

Press / in the main pane to search the view you are reading.

Keys Action
/ Start the search
n Go to the next match
N Go to the previous match
enter Keep the position and close the input
esc Cancel, and go back to where you were

stage shows the number of matches while you type. n and N move through them and continue from the start after the last one.

Press / in any panel to narrow that list. Press esc to clear the filter.

stage embeds fff, a search engine written in Rust. stage uses it for the file filter and for the search. Git information never comes from fff — the git binary is the only source for that.

If fff cannot load, the filter matches plain substrings instead, and the search says that it is not available. stage starts either way.

To read which mode you are in, press ; and open the About section.

Method Effect
STAGE_NO_FFF=1 Starts stage without fff