How to surround selected text in PyCharm like with Sublime Text

PythonSublimetext2Pycharm

Python Problem Overview


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?

Python Solutions


Solution 1 - Python

I think you want something like

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

Solution 2 - Python

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

Solution 3 - Python

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexis BenoistView Question on Stackoverflow
Solution 1 - PythonArnaud PView Answer on Stackoverflow
Solution 2 - PythonAndyView Answer on Stackoverflow
Solution 3 - PythonAdam HView Answer on Stackoverflow