IntelliJ/Rust, mouse-free jumping around files

  1. Sometimes when editing, I need to jump to a file by name. It’s not a function or a struct or a enum within the file I want to jump to. It’s a file that I want to jump to.

  2. I’m using IntelliJ with Rust plugin.

  3. For example, I may have something like:

src/
  util/
    foo.rs
    bar.rs

and I’ll be editing foo.rs and want to jump to bar.rs.

  1. In Vim, there is https://github.com/junegunn/fzf which is nice because I can type ;fzf star typing bar and it’ll jump me to the right file.

  2. In IntreliJ with Rust plugin, there is the nice project tree viewer – but that involves clicking with the mouse, which I am trying to avoid.

  3. If I had a struct / function / enum, I could also hit “goto implementation” – but in my case I just want to jump to file.

  4. There is also shift-shift – but it starts auto completing on EVERY file within any crate within the current workspace.

  5. In IntelliJ/Rust, is there any easy way to jump to a “local” file without using the mouse?

There is Navigate -> File, which is bound to Shift+Ctrl+N by default. But it also searches for all files in the project.

Interesting. I’d really like something that searches up from the current directory i.e.

let X = pwd
the preferred sort order would be
X/*
X/…/*
X/…/…/*

with the files filtered by whatever regex I type

As a rule of thumb, any action in IntelliJ can be invoked with a keyboard. IIRC, the default shortcut to focus project view is alt+1. If the “autoscroll from source” option is enabled as well, the current file will be focused. When project view is focused, you can just start typing the name of the fsibling file: all tree controls in idea come with speed search enabled.

1 Like

@matklad : This is amazing. Thanks! I knew about the “autoscroll to source”, but no idea about the Alt-1 … or that project view had ‘speedsearch.’ Thanks!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.