• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IntelliJ 4.0: My favorite shortcuts

 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
     
    Ranch Hand
    Posts: 2713
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 4313
    Android IntelliJ IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 2713
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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.
     
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    sout+Tabulation changing to : System.out.println()
    serr+Tabulation changing to : System.err.println()

    are great
    [ March 05, 2004: Message edited by: Florent LOTHON ]
     
    author and iconoclast
    Posts: 24207
    46
    Mac OS X Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.
     
    Ranch Hand
    Posts: 15304
    6
    Mac OS X IntelliJ IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I think someone should start putting these on our FAQ.
     
    Chris Mathews
    Ranch Hand
    Posts: 2713
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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
    Posts: 4313
    Android IntelliJ IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 24207
    46
    Mac OS X Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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.
     
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    IntelliJ 4.0 Default Keymap Reference Card
     
    Trailboss
    Posts: 23778
    IntelliJ IDE Firefox Browser Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I like ctrl-D.
     
    Jessica Sant
    Sheriff
    Posts: 4313
    Android IntelliJ IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

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


    What's Ctrl+D do?
     
    Ranch Hand
    Posts: 820
    IntelliJ IDE VI Editor Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
     
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
     
    Mark Spritzler
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I like Ctrl-Atl-Delete. Just Kidding, please, please do not hit those keys.
    Mark
     
    Mark Spritzler
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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
    Posts: 2713
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I have found that using Alt+F4 is always an excellent solution to my most difficult problems.
     
    Mark Spritzler
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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 ]
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic