Quick inserting a relative path in PhpStorm
Is there a fast way for inserting relative path to other file (ex. css,js, image files) in another one? (Perhaps by dragging file in code position)
Ctrl + Space + Space
Hold Ctrl and press Space twice...
Autocompletes relative path...
No, there isn't anything that I would consider "fast" but there are a few tricks that I've found to be useful.
In a large number of contexts PHPStorm will by way of it's auto-complete help you form your relative files references. For example, when typing a PHP require statement, you can use completion to get a list of files and directories in the auto-complete popup, and use that to help you navigate and create the string you want:
The auto-complete doesn't seem to always happen automatically, but you can invoke it. My keyboard shortcut is CTRL+SPACE. From the menu, it's Code -> Completion -> Basic.
You can also use the Copy Reference function available by right-clicking on the file in the Project explorer. This will put a string in your clipboard starting at the project root directory. For example, if your project is located at c:\my\project, and your file is located at c:\my\project\web\assets\js\myscript.js, the string copied will be \web\assets\js\myscript.js.
I tend to use either of these methods depending on what context my cursor is currently in, and whether or not my hand is on the mouse at that moment or not. By far the most useful feature is the auto-complete. I use it very often when creating strings to resources in both HTML and PHP files.