Disable caret moving at comment hotkey

When i do line comment(ctrl+slash) - caret has moved to next line, it's make me mad.
Somehow possible to do exactly same, but without caret moving?

I sought such option in settings, but found nothing.
Comment actions Permalink
You cannot disable that, however you can define a macro.

1) Start with Edit | Macros | Start Macro Recording
2) Press "Ctrl" + "/" to comment out current line
3) Press "Up" to move caret to that line again
4) End with 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.
Comment actions Permalink
Thanks for reply, Anna!

Yes, i already tried it. But it work's not exactly same as native comment hotkey: in python, if i selected a few lines and caret stay on bottom line of selection, and use thats macros - then after caret will be moved up, but with standard hotkey - it's not moving, and that better, i think.

Ладно, видимо ничего лучше с этим всё равно не сделать, спасибо и на этом.
Comment actions Permalink

This is super annoying - why does it do that anyway?


Comment actions Permalink


I'd say that this is more expected behavior because most likely one wants to comment out the line of code and then go to the next one.

Feel free to submit a usability problem ticket to https://youtrack.jetbrains.com/issues/PY though so that other users can upvote.



Please sign in to leave a comment.