简体   繁体   中英

Keyboard shortcuts in Eclipse

Is there a way to change a shortcut in Eclipse that when I press that shortcut Eclipse will write some line of code? Let's say I press Ctrl + Shift + P would it be possible that Eclipse will write <p></p> ?

Thanks

Have a look at the templates support.

WindowPreferencesJavaEditorTemplates

Here is an article describing custom eclipse templates .

As far as I know, no, but as aioobe answered, you can use templates for it. Instead of that keyboard combo, you'd instead type something like par Ctrl + Space to get Eclipse's autosuggest for creating an paragraph open / close tag (with the cursor in the middle). This'll either display a dropdown if Eclipse is unsure, or just chuck your template down if it has no doubts.

Note also that, when editing HTML files (or anything XML~like), you can get Eclipse to auto-close tags, so typing <p> will automatically add a closing tag too. This might of course be a bit trickier due to the Shift + < keyboard combo's (depending on your finger's agility and, possibly, keyboard configuration). I have no trouble with it though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM