How to surround selected text in PyCharm like with Sublime Text

Question:

Is there a way to configure PyCharm to be able to surround selected code with parenthesis by just typing on the parenthesis key, like when we use SublimText 2?

Asked By: Alexis Benoist

||

Answers:

PyCharm 4.0 has the option to Surround With..., by selecting your code snippet and pressing

ctrl + alt + T

or on Mac: + + T

Option 1 should provide you with the functionality you are looking for:

PyCharm Ctrl+Alt+T

Answered By: Andy

I think you want something like

Settings | Editor | General | Smart Keys -> Surround selection on typing quote or brace

Answered By: Arnaud P

Windows: open pycharm and select file, settings, Editor, Smart Keys, in the list you will check “Surround selection on typing quote or brace”, then apply.
enter image description here

Image of pycharm location of smart keys

Answered By: Adam H
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.