Monday, 23 February 2015

Eclipse hotkeys / shortcuts

These are useful shortcuts I always forget after a few weeks not using Eclipse:

Show shortcuts list: ctrl+shift+L

Spellcheck suggestions: ctrl+1
Quick fix suggestions: F2

Rename all occurencies: shift+alt+R
Open resource: ctrl+shift+R
Show Occurrences: ctrl+shift+U
Enable “Block”(rectangle) selection: alt+shift+A
Duplicate Line: ctrl+alt+UP

Select blocks of code: alt+shift+Up (each press selects block one level higher)
De-select blocks of code: alt+shift+Down (each press selects block one level higher)

type hinting (for dynamic typing languages): /* @var $varName \Type */


Preserve case replace:
ctrl+f (edit->find/replace)
tick "Regular expressions" check-box
Find: general
Replace with: \CSeparate

Here \C is a regex retain-case operator it will cause the following results of replacements:
general->separate
General->Separate