If you’re like me, you keep your hands off the mouse and know your IDE intimately. You use shortcuts (keybindings) whenever possible, and if you find yourself reaching for the mouse, you stop and you try to find the shortcut.
Turns out, Eclipse’s ANT editor doesn’t seem to have a keybinding for inserting block comments (<!-- -->). Fortunately, if your Eclipse install has a plugin such as the WTP HTML editor or ColdFusion Builder which includes a “Insert Block Comment” action, then you can easily bind that editor’s action to the ANT editor, thereby getting block comment insertion in ANT build files with a keyboard shortcut. Here’s how:
Binding a Block Comment to a keyboard shortcut
- Window – Preferences
- Filter on “keys” to get to the keybinding property sheet
- In the keybinding sheet, type “html comment” in the filter
- If your editor supports it, one or more rows will appear. Highlight one of them.
- Click “Copy Command”
- In the copied command, down in the “Binding” field, type a keystroke you want to use. I like ctrl+shift+M
- In the “When” dropdown, select “Editing Ant Buildfiles”
- Click “OK” and get out of all that.
Now, when editing an ANT file, you can use your shortcut to insert block comments.