Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add shortcut keys for java code in eclipse

Say I type "sout", the intellisense should expand it to "System.out.println()". Is there a way to adding such templates?

like image 471
Artin Avatar asked Jul 12 '11 02:07

Artin


People also ask

How do I set shortcut Keys in Eclipse?

Display and Edit the Current Keyboard Shortcuts To see the current key configuration and its keyboard shortcuts, choose the Eclipse > Preferences menu command to open the Eclipse workbench Preferences. Select the General > Editor > Keys page.

How do I show keyboard shortcuts in Eclipse?

CTRL + Shift + L : "Show Key Assist", List of shortcuts (depending on the context)


4 Answers

The feature is called "code templates" in Eclipse. You can add templates with:

Window->Preferences->Java->Editor->Templates.

Two good articles:

  • Don't write the code, generate it
  • Custom Templates

Also, this SO question:

  • Useful Eclipse Java Code Templates

System.out.println() is already mapped to sysout, so you may save time by learning a few of the existing templates first.

like image 198
Michael Brewer-Davis Avatar answered Oct 07 '22 23:10

Michael Brewer-Davis


Type "Sysout" and then Ctrl+Space. It expands to

System.out.println(); 
like image 41
Saurabh Gokhale Avatar answered Oct 07 '22 23:10

Saurabh Gokhale


Type syso and ctrl + space for System.out.println()

like image 36
Bala R Avatar answered Oct 08 '22 01:10

Bala R


type "syso" and then press ctrl + space

OR

type "sysout" and then press ctrl + space

like image 26
Jaykishan Avatar answered Oct 08 '22 01:10

Jaykishan