Monday, August 16, 2010

Things I Love About IntelliJ IDEA: Keyboard Navigation of Search Results

One of the things that really helps IntelliJ IDEA deliver on its claim of increased productivity is the JetBrains guys' fixation with keyboard navigation and one area where they've hit a home run with this is in navigating search results. The idea is actually really simple: you can navigate search results using the keyboard: Ctrl-Alt-Down to go to the next result, Ctrl-Alt-Up to go to the previous one.

If I were just to end the blog there, I'd probably have a throng of Eclipse users banging on my door telling me you can do the same thing in Eclipse: "Just click in the Search View, then use Ctrl+. and Ctrl+," they'd say, and they'd be right. But it's the "Just click in the Search View" part which is all wrong. I shouldn't have to click anywhere. Someone might point out that I can can change the focus between different Views using Ctrl-F7, which again would be correct and would again miss the point.

The point is: I'm coding. I'm writing code; I'm searching code; I'm changing code. I don't want to focus on a Seach View, I want to focus on my code. In IntelliJ, I don't even have to have the Search pane visible to be able to browse through the results. I just have to hit Ctrl-Alt-Down and I'm at the next result, ready to edit. In Eclipse, if the window focus is in the Editor and I want to go to the next Search result, I either have to use the mouse to select and double-click on the next result, or I have to change to the Search View (Ctrl-F7, including pop-up View selector window), press down to select the next result, then press Enter to return to the Editor.

This is one of those niggles in Eclipse about which I like to say, "The guy who wrote the Editor plug-in didn't talk to the guy who wrote the Search plug-in". I often get the feeling that while IDEA is the product of a close-knit team aiming to produce a seamlessly integrated code-authoring masterpiece, Eclipse is just a bunch of code-related tools that have been slapped inside the same GUI without enough thought as to how those tools should play well together.

4 comments:

  1. The next time someone asks me why I prefer IntelliJ, I'm just going to show them this.

    ReplyDelete
  2. On the other hand, it's not possible to go to the next compile error this way in IDEA, which IS possible in Eclipe. I've reported this as a problem in their issue tracker, and they closed it saying you can take the little detour via the messages panel, like you describe above.

    Note: I'm a paying customer.

    ReplyDelete
  3. @bosmeeuw: I think what you've said isn't exactly right.

    Within a single file in IDEA, you can jump between errors and warnings using F2/Shift-F2, the same as Eclipse's Ctrl-./Ctrl-,

    However, you can also navigate through the compile errors in all files in IDEA using Ctrl-Alt-Up/Down, but there is a trick: you have to compile first (Ctrl-F9). As you probably know, Eclipse and IDEA have differing ideas of when compilation should happen, and IDEA's cross-file error navigation is reliant on a compilation having been attempted.

    Does Eclipse have a "next error" shortcut that will jump to the next file with an error?
    If it does, I'd love to know what it is.

    ReplyDelete