Bastian's Blog ~~~~~~~~~~~~~~ :Author: lapis :Date: Mon, 19 Apr 2010 11:48:23 +0200 :Revision: 5 :Copyright: CC by-nc-sa =========================================== On short notice: Keybindings in Eclipse PDT =========================================== :Keywords: eclipse, PDT, PHP, keybindings, shortcuts, Unittests, testing, External Tools Framework :Description: :Abstract: I do use the Eclipse PDT a lot for PHP and Javascript development. So most of the time I have my fingers on the keyboard and find it really annoying if I have to grab the mouse to run any kind of repeated or often used action in my IDE. Means I do use shortcuts very often. Inspired by Nils (phphatesme.com) I decided not to write my findings in a mega comment but write this blog article. There was a discussion_ started by Nils Langer (phphatesme.com_) earlier this morning about most often used keybindings in the IDE Eclipse PDT. As I did not want to flood his commtents section with a huge comment I wrote this answer. .. _discussion: http://www.phphatesme.com/blog/tools/nutzliche-eclipse-shortcuts/trackback/ .. _phphatesme.com: http://www.phphatesme.com Switching uppercase to lowercase and vice versa ----------------------------------------------- The coding standards of my employer says that constants have to be written in uppercase letters. But until I find it very uncomfortable to hold down the SHIFT key for the whole word nor am able to find the CAPS LOCK key in time, I always write the name of a constant in lowercase letters and use the following sequence to convert it afterwards: SHIFT + Alt + left arrow (select previous word) CTRL + SHIFT + x (uppercase the selection) For those capable of the ten fingers system it might be too pedestrian, but I an not a ten finger writer I find it right useful. By the way CTRL + SHIFT + y convert the selection to lowercase. Repeatingly running an External Tool Configuration -------------------------------------------------- As I am following the test first paradigm when writing source code. I use the External Tools Framework of Eclipse to run PHPUnit_ to see if my tests are good to go. The drawback on this is that you always have to use the mouse to klick the little icon in the menubar running the latest launched external tool. Last week I finally found a solution for this. There is a predefined action "hidden" in the configuration section (Window > Preferences > General > Keys ) for keybindings in Eclipse named "Run last launched External Tool" which is exactly the event triggered when you hit the run button in the menubar to rerun the e.g. unit tests on the currently active file again. I bound it to SHIFT + CMD + r (yes I am currently using Mac) which freed me from using the mouse a lot of times a day. .. _PHPUnit: http://phpunit.de Editing multiple lines at once ------------------------------ Another more or less unknown keybinding is Alt + CMD + a. Vim_ user might know this imho very nice feature already and as a former Vim user I missed it very badly in Eclipse. Once this keybinding is enabled the mouse pointer changes into a target pointer. If you now select a multiline section with your mouse the selection will not cover the whole lines as usual, but only the section you chose. If you now start typing each line will geht the same content as what you entered. Since the keybinding toggles the blockedit mode you just it it again and you are back in the normal edit mode. .. _Vim: http://www.vim.org Cheatsheet ---------- Since this article only represents a small set of my daily used shortcuts the need for a cheatsheet or a conclusive overview over every keybinding would be very nice. As a matter of fact there a re two of those overview. The first and system specific one you find if you hit SHIFT + CMD (CTRL on windows) + l which causes a popup to appear in the lower right corner of your workspace. The other more general one is a cheatsheet created by Carsten Ullrich available on sourceforge_. This cheatsheet afaik does not cover all available shortcuts, but do give you a good overview on common used keybindings. .. _sourceforge: http://eclipse-tools.sourceforge.net/shortcuts.html Trackbacks ========== Comments ========