Useful Keyboard Shortcut Keys for Eclipse and STS
Eclipse and Spring Tool Suite (STS) are the two important Integration Development Environments (IDE's) used massively in java development. The beginner and intermediately experienced java developers often find it a little time consuming, to do certain operations such as file search, finding a keyword in the code and many more when they are new to java IDE's. In my initial days, as a java student, I had experienced the similar issues because of which I always used to think, "When will I get some tips to know some keyboard shortcuts in such IDE's?".
Today, as an experienced java development enthusiast, here are some of the useful keyboard shortcut keys widely used by java developers while working with Eclipse and STS IDE's. The lists are categorized on the activities performed.
- File Navigation
2. Ctrl+E : "Open a file from within the list of all open files". This shortcut is used to find all the files that are open and present in the file editor window.
3. Ctrl+PgUp : "Navigate to previous file from within the list of all open files" . This shortcut is used when the developers wants to go to previous file within the list of open files in the file editor window.
4. Ctrl+PgDn : "Navigate to next file from within the list of all open files". This shortcut is used when the developers wants to go to next file within the list of open files in the file editor window.
5. Alt+<- (left arrow key) : "Go to previous edit positions from editor history list". This shortcut is used by the developers if they want to go to previous edit position in the file editor window. The edit position can be between 2 different files or within same file in the file editor window.
6. Alt+-> (Right arrow key) : "Go to next edit positions from editor history list". This shortcut is used by the developers if they want to go to next edit position in the file editor window. The edit position can be between 2 different files or within same file in the file editor window.
- Java Editing
2. Ctrl+Shift+F : "Format Code". This shortcut is used by developers to change the font of the code to look more presentable.
3. Ctrl+O : "List all methods of the class". This command will list all the methods defined in the class. The developers can select any method which he wants to call in that class.
4. Ctrl+/ : "Single line comment". The developer can select a line and click ctrl+/ and a single line comment '//' will appear on that selected line. The same shortcut can also be used to uncomment the same line.
5. Ctrl+Shift+/ : "Multi-line comment". The developer can select more than one line of code and use this shortcut and those lines will be commented in multiline comment format '/**/'. To uncomment use Ctrl+Shift+\ command (note the backslash).
6. Ctrl+D : "Delete a line". This shortcut is used by the developer to delete a line from the code.
7. Ctrl+Hover mouse : The developer gets 'Open Declaration', 'Open Initialization' and 'Open Datatype' of a function and a variable in the file by hovering mouse on that particular function or variable respectively while clicking Ctrl. If the developer selects 'Open Declaration' then, the control will go to the declaration line of that particular variable or function. If he selects 'Open Initialization' then, the control will go to initialization part of the function in any particular file within that project. If he clicks on 'Open Datatype' then, the developer will get the datatype of the function or the variable.
- Debug and Run
2. F6 : "Step over". This key is used by developers to get into functions or subroutines while debugging the code without entering into the definition.
3. F7 : "Return". This key is used by the developer to come out of the functions and subroutines while debugging.
4. F8 : "Continue". This key is used to jump to next breakpoint if available. Otherwise it executes the whole program and comes out of it.
5. Ctrl+F11 : "Run Last Run Program". This shortcut is used by developers to run the last run or build of the program.
- General Search
2. Ctrl+H : This shortcut is used to search variables or words in any file such as java, javascript and others.
3. Ctrl+F : This shortcut is used to find any word or variable in that particular window.
Conclusion
The keyboard shortcuts in STS and Eclipse are plenty to discuss. I have discussed few of those which I have used while coding. If you know more keyboard shortcuts, have any feedback or suggestions then, please feel free to use the comment box below.
Stay tuned for more updates on "How to enable keyboard shortcuts in eclipse or STS IDE's".
Much needed shortcuts in developer's field. You made my life easier 😃
ReplyDeleteThank you for supporting our blog!
ReplyDelete