Insert pair '}' in string?

Answered

Is there any option to automatically insert '}' when '{' is typed in a string? Very handy when using string.format which is what is probably expected when using '{' in a string.

1
3 comments

Hello!
Please go to Settings (Preferences for Mac OS) | Editor | General | Smart Keys and enable “Insert paired brackets...”.



0
Avatar
Permanently deleted user

That is not what I am asking.

0

Sorry, I have misunderstood.
Unfortunately, “Insert paired brackets” feature does not work in the string literals. Please feel free to create a feature request about it https://youtrack.jetbrains.com/issues/PY and let us know if you have any problems with it.

You could try to record a macro, which will perform the actions you have recorded (for instance, inserting some code) and then bind a shortcut to this macro (please follow the article for that purpose https://www.jetbrains.com/help/pycharm/using-macros-in-the-editor.html).

0

Please sign in to leave a comment.