Navigation Bar Intro
Move around files with keyboard, without wasting screen UI space
We want to get you into the flow of development. No UI distractions, hands on the keyboard, moving quickly and efficiently through your work.
Some times you need to work with files and directories. How can you stay in the flow when navigating your files?
This series of tips shows the Navigation Bar: activate it on demand, cursor and speed type your way through listings, and do your operation.
Activate Navigation Bar
Bring up the Navigation Bar as needed, let it disappear when finished.
Getting into the flow means stripping down your UI distraction (turn off the
Project
window and Navigation Bar
) then going keyboard-centric to avoid
the mouse. But you still need to get to your files, and sometimes you'd prefer
to browse instead of use Recent Files
or the Find File
action.
If you've uncluttered your UI by hiding the Navigation Bar, bring it back on demand.
Use Navigate -> Jump to Navigation Bar
(Alt-Home
Win/Linux, Cmd-Up
macOS)
to temporarly re-active the Navigation Bar, but as a temporary panel. Once
you use use it, the window disappears.
If you use this tip and temporarily make it appear, how do you make it disappear?
Press Jump to Source
(F4
Win/Linux, Alt-Down
macOS) or just hit Escape
to go back to where you were working.
Perhaps you didn't hide the Navigation Bar. I don't, because I like those other toolbar buttons to the right. But still, you'd like to use it without the mouse. Activating the Navigation Bar still helps, as it moves the focus out from the editor and up to the Navigation Bar, where you can then use your cursor keys.
How did we hide it in the Navigation Bar first place, or bring it back if wanted?
The View
menu's Navigation Bar
item is a toggle. Want a faster, keyboard-centric
way to toggle? Find Action
(Shift+Ctrl+A
Win/Linux, Shift+Cmd+A
macOS) lets
you search for such settings and even toggle inline. Type vi nav
to speed search,
make sure the selection is on View: Navigation Bar
, then press enter. The
setting is toggled...no mouse usage needed.
Navigate Files With Navigation Bar
Move around your project tree and select files, from your keyboard, with the Navigation Bar.
We've discussed "getting into the flow"...strip down the IDE to focus and don't take your hands off the keyboard. But if you've turned off your Project tool window, how can you navigate files and directories?
You could use the Project
action (Alt-1
Win/Linux, Cmd-1
macOS) to bring
back the Project tool, do your work, and then hide it again. Instead,
temporarily bring back the Navigation Bar then navigate it with the keyboard.
You can use the left arrow to go up a directory and right arrow to go down a directory. To see the contents of a directory, either press the down arrow or press enter. With this you can get to any place in the tree, without using the mouse.
For looking at the directory the currently-edited file is in, this is even
easier. Activating the Navigation Bar makes the current file selected. You
don't have to press Left
to select the parent directory. Just press
Down
.
Open File With Navigation Bar
Open a file somewhere in the project tree using the keyboard and Navigation Bar.
If you've closed the Project Tool window and hidden the Navigation
Bar, you need a way to open file that's keyboard centric and doesn't
disrupt your flow. Usually, the fastest way to open a file is the
various search options (Recent Files
, Navigate to File
, etc.)
But other times, you want to browse instead of search.
As shown previously, use the Navigation Bar to select a file:
-
Activate the Navigation Bar with
Navigate -> Jump to Navigation Bar
(Alt-Home
Win/Linux,Cmd-Up
macOS) -
Use the cursor keys to get to the target directory
-
Speed search to select the file
Once selected in the Navigation Bar, press Enter
and the IDE will
open your file. Clicking with the mouse also works.
As a note, this is a very common pattern for jumping to a file in
the current directory. In this case, you don't have to press
Left
to go up to the directory. Even though the current file selected,
you can still press Down
or better still, just start speed searching.
Opening the file isn't the only operation you can do on a selected
Navigation Bar item. You can Refactor This
, delete...basically,
anything you could do when you click on the file in the Project Tool.
We'll see two examples in subsequent tips.
Create New File With Navigation Bar
Activate the Navigation Bar and create a new file somewhere in the project tree.
How can I create a file if I've turned off the Project Tool? Let the Navigation Bar be your one-stop replacement for the Project Tool.
First, get to the target directory:
-
Activate the Navigation Bar with
Navigate -> Jump to Navigation Bar
(Alt-Home
Win/Linux,Cmd-Up
macOS) -
Use the cursor keys to get to the target directory
-
Speed search to select any subdirectories
Once your target is selected, use New
(Alt+Insert
Win/Linux,
Cmd-N
for macOS) to bring up the new file dialog. Just like in
the Project Tool, the new file is opened after creation.
Also like the Project Tool, your selection doesn't have to be on a directory. If you're on a file, the new file will be created as a sibling. This is particularly useful in the common case of creating a new file in the current directory:
-
Activating the navigation bar higlights the current file
-
Immediately press
New
(Alt+Insert
Win/Linux,Cmd-N
for macOS)
Quite simple: two key combos and you have a new sibling file, with no permanent file tree visible and no popups to close afterwards. That's what getting in the flow is about.
Narrow Navigation Bar With Speed Search
Narrow and select from a long folder listing Navigation Bar by typing a speed search.
We've discussed getting into the flow by reducing UI clutter and being keyboard-focused. We're using the Navigation Bar on-demand to get to targets in our project tree.
When we get a drop-down for contents of a directory, sometimes the listing is long. We don't want to press down arrow a bunch of times. Instead, use the IDEs "speed search" facility to quickly dive through a long listing.
As shown previously, use the Navigation Bar to get to a directory listing:
-
Activate the Navigation Bar with
Navigate -> Jump to Navigation Bar
(Alt-Home
Win/Linux,Cmd-Up
macOS) -
Use the cursor keys to get to the target directory
We now want to select one item in the list, but using speed search:
-
Simplest case: Type one letter
-
Type a second letter...if your choice is selected, then you're done and you can act on it (e.g. press enter,
Ctrl-T
to refactor, etc.) -
Type a period and a letter to search in the file extension
This becomes a very fast workflow for speeding through the navigation bar, all without using the mouse. Moreover, speed search is a pervasive pattern in the IDE.
Find In Path With Navigation Bar
Use keyboard and Navigation Bar to find files under a path.
You want to find a file at a path in your project tree. But you've turned off the Project Tool. You could turn it back on, find the file, then turn it back off. But then you'll talk yourself into leaving it visible.
Use the Navigation Bar instead:
-
Activate the Navigation Bar with
Navigate -> Jump to Navigation Bar
(Alt-Home
Win/Linux,Cmd-Up
macOS) -
Use the cursor keys to get to the target directory
-
Speed search to select any subdirectories
Then, when your target is selected:
- Invoke
Find in Path
(Shift+Ctrl+F
Win/Lin,Shift+Cmd+F
on macOS) to bring up theFind in Path
dialog.
Just like you would in the Project Tool. Except, no permanent real estate lost and the Navigation Bar appears/disappears on command. All without touching the mouse.