aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes IntelliJ 4.0: My favorite shortcuts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "IntelliJ 4.0: My favorite shortcuts" Watch "IntelliJ 4.0: My favorite shortcuts" New topic
Author

IntelliJ 4.0: My favorite shortcuts

Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

So -- I thought it would be helpful to start a thread about what our favorite IntelliJ IDEA 4.0 shortcuts are. IntelliJ is the only program that I leave the "show tips at startup" thing on -- beacause I actually learn a lot of cool things in there.
But -- I've found that one of the best ways to find out waht other cool features it has is word-of-mouth (or in this case word-of-keyboard I guess).
So -- here's my list of really cool stuff I've found I can do with IntelliJ that I use all the time -- what about you?
  • Alt+Enter -- automagically imports the class you just typed.
  • Ctrl+Space -- shows all possible methods that could be called at this point.
  • Shift+F6 -- refactor: renames the class / method / variable, whatever the cursor is on now.
  • Ctrl+F6 -- refactor: change method signature
  • Alt+Insert -- popus up a menu to add Getters / Setters / Constructors / Equals / Hashcode
  • Ctrl+Shift+Tab -- pops up a menu to surround the currently selected code with if/else, try/catch, etc
  • Alt + --> or Alt + <-- -- tabs between edit windows


  • [ March 03, 2004: Message edited by: Jessica Sant ]

    - Jess
    Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
    Chris Mathews
    Ranch Hand

    Joined: Jul 18, 2001
    Posts: 2712
    The shortcuts I probably abuse/use most often, besides the ones Jess mentioned, are:
  • Middle Click or Ctrl-B - Browse to declaration.
  • Ctrl + Alt + O - Optimize Imports.
  • Ctrl + Alt + L - Format Code.
  • Ctrl + N - Goto Class.
  • Ctrl + Shift + N - Goto File.
  • Ctrl + G - Goto Line.
  • Ctrl + F12 - Structure Popup.

  • Jessica Sant
    Sheriff

    Joined: Oct 17, 2001
    Posts: 4313

    ahhh forgot the Ctrl+B -- I've started using that one more. I'll have to get int he habit of the Ctrl+F12 for the stucture pop-up.
    What does the optimize imports do?
    Chris Mathews
    Ranch Hand

    Joined: Jul 18, 2001
    Posts: 2712
    Originally posted by Jessica Sant:
    What does the optimize imports do?

    Adds any needed imports. Removes any unneeded imports. Condenses fully qualified imports to wildcard imports if the number of imports used in a package goes beyond a configurable threshold.
    I am addicted to Ctrl+N and Ctrl+Shift+N... so much so that I rarely ever use the file navigator.
    Flo
    Greenhorn

    Joined: Aug 28, 2003
    Posts: 12
    sout+Tabulation changing to : System.out.println()
    serr+Tabulation changing to : System.err.println()

    are great
    [ March 05, 2004: Message edited by: Florent LOTHON ]

    Sun Certified Enterprise Architect<br />Sun Certified Web Component Developer for J2EE platform<br />Sun Certified programmer 1.4
    Ernest Friedman-Hill
    author and iconoclast
    Marshal

    Joined: Jul 08, 2003
    Posts: 24183
        
      34

    Besides Alt-Enter and Ctrl-Space, my favorite IDEA keystrokes actually come from plug-ins. They are Ctrl-t (navigate to or create JUnit test) and Ctrl-C C (execute this single test method) both from the unitTest plug-in. A close third and fourth would be the Emacs-style Ctrl-k (kill) and Ctrl-y (yank) from the IDEAmacs plug-in.


    [Jess in Action][AskingGoodQuestions]
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand

    Joined: Jul 11, 2001
    Posts: 15299
        
        6

    I think someone should start putting these on our FAQ.


    GenRocket - Experts at Building Test Data
    Chris Mathews
    Ranch Hand

    Joined: Jul 18, 2001
    Posts: 2712
    Originally posted by Ernest Friedman-Hill:
    A close third and fourth would be the Emacs-style Ctrl-k (kill) and Ctrl-y (yank) from the IDEAmacs plug-in.

    I forgot Ctrl+Y (delete a line). I use that all the time... I like to delete code.
    Jessica Sant
    Sheriff

    Joined: Oct 17, 2001
    Posts: 4313

    ugh, that Ctrl+Y screws me up.... on other apps (like M$ Word) Ctrl+z is undo and Ctrl+y is redo.... so if I goof and need to undo something... i hit Ctrl+z which works just fine... but if I undo too far and hit ctrl+Y to try to redo it..... it deletes the line!!! so then I have to Ctrl+z again and the whole vicious cycle starts anew.......aaaarrrghhhhh
    Ernest Friedman-Hill
    author and iconoclast
    Marshal

    Joined: Jul 08, 2003
    Posts: 24183
        
      34

    Originally posted by Jessica Sant:
    ugh, that Ctrl+Y screws me up.... on other apps (like M$ Word) Ctrl+z is undo and Ctrl+y is redo....

    That's insane! Everyone knows that control-Z is "suspend" and undo is Ctrl-underscore. And CTRL-v is page-down. And ctrl-a is beginning-of-line and ctrl-e is end-of-line, and ...
    The existence of the IDEAmacs plugin was the thing that made it possible for me to switch from Emacs to IDEA in the first place.
    Marilyn de Queiroz
    Sheriff

    Joined: Jul 22, 2000
    Posts: 9044
        
      10
    IntelliJ 4.0 Default Keymap Reference Card


    JavaBeginnersFaq
    "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
    paul wheaton
    Trailboss

    Joined: Dec 14, 1998
    Posts: 20529
        ∞

    I like ctrl-D.


    permaculture Wood Burning Stoves 2.0 - 4-DVD set
    Jessica Sant
    Sheriff

    Joined: Oct 17, 2001
    Posts: 4313

    Originally posted by Paul Wheaton:
    I like ctrl-D.

    What's Ctrl+D do?
    Tim McGuire
    Ranch Hand

    Joined: Apr 30, 2003
    Posts: 820

    The most useful one for me is CTRL + J, which brings templates.
    it is also used with live templates so that
    if you type "it" and then CTRL + J, you get a list of iterations.
    type sout and CTRL + J you get a System.out.println("|") statement
    Mark Spritzler
    ranger
    Sheriff

    Joined: Feb 05, 2001
    Posts: 17250
        
        6

    For a second there I thought Ctrl-J was not going to be said, but also not said is
    Ctrl-I,
    when you have a class implement an interface, hit Ctrl-I and a list of all the methods in the interface are listed. Select the ones you want, which to me is everything, heck you have to implement them don't you, and click ok or hit enter, and the method skeletons are added to your implementing class.
    Funny thing about Ctrl-J is that is also works in JSP pages, although the only choice you have it tag, but you type in the value for the tag, and both tags get filled with the tag name.
    I also love Alt-Enter, I mean talk about saving keystrokes.
    Mark


    Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
    How to Ask Questions the Smart Way FAQ
    Mark Spritzler
    ranger
    Sheriff

    Joined: Feb 05, 2001
    Posts: 17250
        
        6

    I like Ctrl-Atl-Delete. Just Kidding, please, please do not hit those keys.
    Mark
    Mark Spritzler
    ranger
    Sheriff

    Joined: Feb 05, 2001
    Posts: 17250
        
        6

    Originally posted by Jessica Sant:

    What's Ctrl+D do?

    On the chart it says it duplicates current line or selected block.
    So Paul is using the new version of Copy and Paste coding.
    Mark
    Chris Mathews
    Ranch Hand

    Joined: Jul 18, 2001
    Posts: 2712
    I have found that using Alt+F4 is always an excellent solution to my most difficult problems.
    Mark Spritzler
    ranger
    Sheriff

    Joined: Feb 05, 2001
    Posts: 17250
        
        6

    Alt-F4 seems to work perfectly for me too.
    It amazes me that every program finds that keystroke to be the best of all the keystrokes that application has.
    Mark
    [ April 17, 2004: Message edited by: Mark Spritzler ]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: IntelliJ 4.0: My favorite shortcuts