How to stop moving one line down while commenting in PhpStorm? - phpstorm

Whenever I comment (Ctrl + /) in PhpStorm, the IDE automatically moves the pointer one line down. How do I disable that?

You cannot. I mean: there is no option for that.
But you can try a workaround using Macro: https://stackoverflow.com/a/27545802/783119 ... or make a selection (1 symbol anywhere in the line will be enough) before using the shortcut.
Other than that: https://youtrack.jetbrains.com/issue/IDEA-119435 -- watch this ticket (star/vote/comment) to get notified on any progress.
P.S. I personally like current behaviour: it allows me to quickly disable & enable subsequent lines (in any supported language/file format that has line comments) without making any selection.

Related

How to not close the editor window when closing the last tab in VS Code

If there's only one tab on an editor in VS Code, the default behavior is to close the editor right then and there.
Personally, and I think many others agree with me, this behavior is very annoying since the programmer would rather preserve the layout he or she created for the project's workspace.
How do I change this behavior?
I've found discussions on this topic, but all of the solutions do not seem to be the ideal one of simply leaving the editor open but empty. Most of them simply delete the related shortcuts, which seems to me like cutting your arm off just because you broke it.
Anyway, here are some useful links:
Superuser StackExchange: How to prevent VScode from closing editor when pressing ctrl+w with no tabs open?
Issue #54492: Remove CtrlCmd+W keybinding to close window when no editors are opened
The behavior of the shortcut ctrl+w is as-designed closing the application
Actually, VSCode 1.57 (May 2021) will change that:
Removed Cmd+W / Ctrl+W as keybinding to close window when no editor is opened
We have gotten feedback that users are frustrated when the window suddenly closes after having closed the last editor via rapid Cmd+W / Ctrl+W usages.
A quick poll in the team also revealed that many had the keybinding for closing a window unassigned, so we went ahead and removed Cmd+W / Ctrl+W as keybinding to close window when no editor is opened.
You can easily bring the keybinding back by configuring it as follows:
{
"key": "cmd+w", // use "ctrl+w" on windows
"command": "workbench.action.closeWindow",
"when": "!editorIsOpen && !multipleEditorGroups"
}
Note: on all platforms there is a dedicated assigned keybinding to close the window:
macOS: Cmd+Shift+W
Linux: Alt+F4
Windows: Alt+F4
If what you are looking for is to preserve empty groups as well as empty editor windows, there is an option in the preferences that gets you almost all of the way:
"workbench.editor.closeEmptyGroups": false
This has the effect that an editor group will stay open even if the last tab within it is closed.
but all of the solutions do not seem to be the ideal one of simply leaving the editor open but empty
Reddit has an answer providing you the ideal solution of leaving the editor open, but empty: close all tabs but leave editors open.
In brief, they suggest to use in rapid succession the "close all editors" and the "three column editor layout".
They suggest to create a macro like:
"macros": {
"closeAllTabs": [
"workbench.action.closeAllEditors",
"workbench.action.editorLayoutThreeColumns"
]
}
then bind it to a key combination. macrosRe is advised.
The behavior of the shortcut ctrl+w is as-designed closing the application, see #49023. It is advisable to remove the shortcut and cut the arm, since it is design to work like that. However, for version 1.43.1 a new comment was posted this year on a thread you linked. You might want to have a look at it as well.

Is there a keyboard shortcut to select a code from start to end in current line?

I know these shortcuts:
Ctrl + W: it selects code until the an space
Select line at caret (I don't remember its shortcut key): it selects whole line with extra spaces:
But I'm looking for a shortcut that only select code from start to end like this :
Different between "Select line at caret" vs Mine request:
differences
Well, Ideavim works on PhpStorm. Provides vim experience in InteliJ .
Using this plugin, <SHIFT-V> selects a line.
Just be aware that you might need to know vim to use it further.
Anyway, it is a cool plugin.

Is there any shortcut to select entire code block in Atom similar to Option + Up Arrow in PhpStorm

Is there any shortcut to select entire code block in Atom similar to Option + Up Arrow in PhpStorm?
It helps you select the code block and if you press Option + Up Arrow again, it expands the selection to its parent block.
Is there any shortcut or plugin to have that feature? It makes it faster to work with heavy code.
Yes! You want the expand-region plugin, it's great! Add these to your keymap.cson to expand the region with option-up (alt-up on windows) :
'atom-text-editor':
'alt-up': 'expand-region:expand'
'alt-down': 'expand-region:shrink'
Ctrl+Alt+M (Cmd+Ctrl+M on Mac) selects entire code inside the current brackets. It doesn't expand to the parent block though.
If you need that feature, you might want to look for some package. There is select-scope package that claims to add that functionality. I haven't tested if it works. It also doesn't seem to show up on the package list in every atom version.
If you decide to try that package out, you may need to override it's key-binding as it uses Ctrl+S.
This is now built into Atom.
https://blog.atom.io/2018/10/23/atom-1-32.html
Select Larger/Smaller Syntax Node

Hotkey to jump past closing brackets in JetBrains PhpStorm

Right now I'm just using PhpStorm to work with some HTML, and it's great in that it auto indents and automatically closes out HTML tags.
The only problem is this feature doesn't really save me any time because I then have to use my mouse or arrow keys to navigate past the closing tag when I reach it. For example I type <p> and it closes it out <p></p> with my cursor in between, but when I'm done I either have to manually navigate past the closing bracket or use Shift+Enter to jump down to the next line (which isn't always what I want to do).
Is there a command that will just jump me to the end of the next closing bracket, or is there a way of setting this up? I've googled it but haven't been able to find anything.
I've googled it but haven't been able to find anything.
Well... Help | Default Keymap Reference has the most needed shortcuts and actions listed and the one you need is there.
In any case:
Ctrl + ] -- Navigate to code block end -- will jump to the closest closing tag (in HTML) or brace/closing keyword (CSS, PHP).
Ctrl + [ will do the opposite -- jump to the opening tag.
There are few other actions that can help here but may not have any shortcuts assigned by default -- check them in Settings (Preferences on Mac) | Appearance & Behaviour | Keymap (it has search by action name and even by already assigned shortcuts).
Another alternative (or better say -- advanced navigation) would be using AceJump pluign (you have to see it in action -- you either like or hate it).. or even Vim mode navigation (via IdeaVim plugin).
The simplest way to go about this is to press Command + -> (command+right arrow key) when your cursor is inside the brackets, and this will bring you behind the last bracket.
At least, I believe this is what you're asking.
hi, use mac os for: cmd + option + ]

PhpStorm keyboard shortcut for code inspection recommended resolution?

If you run a code inspection, you might get something like this in the results panel:
Problem synopsis:
Traditional syntax array literal detected (at line 193)
Problem resolution:
Convert Array Syntax To Short
i.e. it's telling you to change array() to []
The 'resolution' is clickable and it'll fix it for you. But is a keyboard shortcut, or a way of shading identical problems (often you get a bunch of them) and having them fixed for you all at once?
You can use f2/Shift+f2 to jump to next/previous error, then hit Alt+Enter, Enter to apply suggested fixes.
Note that there is a Code | Code Cleanup... command that runs inspections against your code and applies quickfixes. But it only includes a small subset of available inspections that are considered 'safe', so that applying hotfixes automatically doesn't break anything
Use standard shortcut: same as for invoking intentions menu (Quick Fix menu) manually in Editor: Alt + Enter (for Windows/Linux, not sure what that would be on Mac)
Also you can take a look at this tool: https://github.com/fabpot/PHP-CS-Fixer