4

I was using vim for a while (I know there is a intellij vim plugin), and I am curious what the built in IntelliJ text navigations exist?

  1. How can I open up live templates to create a template?
  2. How can I see a list of templates that exist that start with 'tr'
  3. How to perform a global search and search in current document? (and then go to next)
  4. How to see the return type of a method?

I appreciated the guidance!

P.S Any cool text navigation shortucts you want to share?

PPS Can you pull the unit testing window out of the editor and move it to another monitor?

Update

I am on a Mac

codecompleting
  • 9,251
  • 13
  • 61
  • 102

4 Answers4

6

Re PPS: Yes; click on the gear cog/settings in the upper-right, undock it.

It doesn't do what I want it to, which is act as a completely independent window, however, which is a PITA. You can always get back to it with CMD+4.


Not sure what qualifies as "cool", I use these a lot:

  • CMD+F12, quick outline
  • CMD+W, select block (widens on subsequent presses)
  • CMD+D, duplicates current line (or selection, including methods, etc.)
  • CTRL+], move caret to code block end (and CTRL-[)
  • SHIFT+RETURN, open new line below current and move cursor
  • CMD+-,CMD+= collapse, expand region, SHIFT+those does whole buffer.
Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • @codecompleting First rule of kill ring... The [emacs explanation](http://www.cs.cmu.edu/cgi-bin/info2www?(emacs)Kill%20Ring) sums it up nicely. Although with CMD-SHIFT-V I'm not sure if it's really necessary, now that I think about it. – Dave Newton Feb 09 '12 at 15:45
  • which one tells u the return type? – codecompleting Feb 09 '12 at 16:31
  • 1
    @codecompleting CTRL-J, it opens up the Javadocs in a popup, as per my edit to Peter's answer. – Dave Newton Feb 09 '12 at 16:43
3
  1. Preferences->Live Templates
  2. Write tr and press CMD-j (probably CTRL-J on Windows)
  3. CMD-F (CTRL-F), F3 goes to next search result
  4. CTRL-J opens "quick documentation" which shows the return type plus Javadocs.

More info about keyboard mappings and shortcuts:

Community
  • 1
  • 1
Peter Svensson
  • 6,105
  • 1
  • 31
  • 31
3
  1. Cmd+, type "Templates"
  2. Write "tr" and press CMD+J
  3. Shift+CTRL-F
  4. Autocomplete (Ctrl+space) should show this.
Cliff
  • 10,586
  • 7
  • 61
  • 102
  • CMD-+ does nothing for me, nor does Shift-CMD-F, with the default bindings--CMD-= will expand a collapsed region, though. – Dave Newton Feb 09 '12 at 15:40
  • I'm sorry I meant Ctrl+Shift+F! I'll update my answer. Also it's Cmd+"COMMA" not Cmd and plus. Cmd+"COMMA" to bring up the pref pane then type template to open the file templates preferences. – Cliff Feb 09 '12 at 16:07
  • Ah, gotcha. But Ctrl-Shift-F is find-in-path, not the current document. – Dave Newton Feb 09 '12 at 16:12
  • The original question was "how to do a global search and search in the current document". Find in path will open up search for all options allowing you to toggle between whole project, specific directory, or current file. – Cliff Feb 09 '12 at 16:26
1

A few related shortcuts to your query I commonly use in intelliJ(9.0.4) I will not repeat the Live template ones as other users have jotted them down and common shortcuts. Hope this helps ;)

How to see the return type of a method? For this I use (also displays javadoc if available) Ctrl + Q

Ctrl + Shift + F7 = Highlights usages of element at caret (you can also turn this on by default, see Editor->Highlight on Caret Movement). Similar behaviour to Eclipse.

Ctrl + W = Successively start selecting code blocks, quite handy.

This short cut is quite useful

Ctrl + Shift + A = Overall search intelliJ options.

Also have you used the Help->Productivity Guide? Useful info about how you have used the intelliJ features. Started noticing this few days ago.

MalsR
  • 1,197
  • 1
  • 12
  • 23