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.
3
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.
0
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.

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

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

 

0

@Nicolaibiker

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.

 

0

> most likely one wants to comment out the line of code and then go to the next one.

I see nothing to substantiate this.

Plus it overlooks the case of uncommenting out the line of code and then wanting to edit it. There is no reasonable expectation one would want to comment out a line of code and then necessarily edit the next one.

0

请先登录再写评论。