Refactoring (renaming) variables and applying the change to all locations that use it is as easy as selecting right-click -> refactor, pressing SHIFT+F6 or even pressing SHIFT+ALT+CTRL+T to summon the entire refactor menu as shown in the animation below:ĬTRL+F12 will summon a popup that lets you select a method in the current file to which you want to jump. ESC escapes this mode and returns you to the editor, unless you make a file selection in the breadcrumbs – then the file is immediately in focus. Pressing ALT+Home will let you use your cursors to move through the breadcrumb navigation at the top. I’ve found this especially useful when I need to paste a deeply indented part of my code, but don’t want the preceding whitespace copied as well: This happens:Ĭolumn selection mode can be summoned by holding the middle mouse button down and dragging over a piece of code. For example, you if you have an HTML snippet written in a PHP string, you can ALT+ENTER in the string’s content and select Edit HTML content. function call -> instance and function call -> row -> entire row -> method -> containing class…):Ĭontext-aware editing will allow you to edit a string that’s written in another language in a dedicated editor, complete with code hinting and autocompletion. Repeating the combination then expands the selection to include the parent node – all the way to the entire file (e.g. Perhaps somewhat counter-intuitively, CTRL+W (which is most often used for closing tabs, so you may want to remap it) will select a “unit” of code under your cursor (a word, a variable, etc). The full Emmet cheat sheet for CSS and HTML can be found here. You can choose where to position your cursor, add variables, and much more. Typing div#myDiv>span.mySpanClass>ul>li*5 and hitting tab will turn into:įurther extend this in any language of your choice by adding your own expandable templates into the Settings -> Editor -> Live Templates dialog. Generate full HTML without writing it out, using Emmet, built into PhpStorm. Forgot how the code reformat shortcut goes? Just CTRL+SHIFT+A and type “refor.”: CTRL+SHIFT+A will spawn a command search popup. If you’re in love with Sublime’s ability to search for commands of the IDE itself, you can do that too. PhpStorm remembers multiple clipboard contents – you can press CTRL+SHIFT+V to summon a popup which lets you paste clipboard content that’s less recent than the latest. The search is fuzzy, and also supports line numbers – you can use abbreviations followed by :XX where XX is the line number: This can range from turning off error reports for suppressed notices (something I recommend against), to merging CSS rules:ĬTRL+N and CTRL+SHIFT+N will let you instantly move to any part of any class or file in your entire project: Clicking this light bulb or pressing ALT+Enter will suggest solutions – in any language. When PhpStorm detects some problems, it will underline the problematic area and summon a lightblub on top of it when you hover your mouse or keyboard cursor in that area. Holding down CTRL when hovering over variables or methods will give you their full names or locations of declaration, while CTRL+Clicking on a variable or method, or pressing CTRL+B when on a method’s call or on a variable will take you directly to where it’s defined:ĬTRL+Space will summon a code hinting dialog, if you accidentally closed it or for some reason it didn’t open: This is very useful when dealing with large files and having to reference another part only to come back to the original to continue the work: Pressing CTRL+SHIFT+Backspace, or the “Forward” and “Back” buttons on your mouse if you have them, will walk you through your previous edit locations. If you’re on Linux, your CTRL+ALT+L shortcut might already be bound to “Lock Screen”, and you’ll need to unbind it from the system, or change it in PhpStorm’s settings. Note, however, that if you’re working on a project with someone else, this might cause refactors in various files far too often, and pollute your version control system with changes that aren’t changes at all. If you use this excessively and don’t often work on other people’s projects, you take it up another notch – bind a macro to the CTRL+S shortcut, and make PhpStorm automatically reformat your code on every manual save. What’s more, as you can see by the popup that appears in the animation above, you can choose to reformat your entire project. Let’s see some shortcuts and hacks we can take advantage of:ĬTRL + ALT + L, one of my most used keyboard combos, will immediately format your code according to the preferred style guidelines: PhpStorm’s high configurability (it’s almost an “Android” of the PHP IDE world) lets you fine tune it to infinity – you can make it into a tool so personal, it might seem like a different IDE to anyone opening your settings.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |