If I comment out or in a line with Ctrl+/ in IntelliJ 14 the cursor moves a line down. How can I disable that?
Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.
To quickly add a line comment in IntelliJ IDEA, press ⌘ / on macOS or Ctrl + / on Windows and Linux. Block comments or multi-line comments usually take the form of a paragraph.
Comment and uncomment blocks of codeFrom the main menu, select Code | Comment with Block Comment. Press Ctrl+Shift+/ .
Move Caret to Line End Alt + L.
You cannot disable that, however you can define a macro.
Edit | Macros | Start Macro Recording
Edit | Macros | Stop Macro Recording
The caret will return to the same logical position as before, just as expected.
You can assign that macro to any keyboard shortcut you like: Settings | Keymap | Macros
workaround with no macros: if you select the line or a single character from the line, and then comment out, the caret will stay at same position.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With