Search code examples
pythonpycharmtabs

How to tab left in Pycharm


In most editors when you click Shift+Tab the selected text moves 4 spaces to the left. This doesn't work for me in Pycharm. I'm in Windows 10 and using Pycharm 2021.3.3 Professional Edition.

What I have:

    def my_function():
        my_code
        return my_result

What I want:

def my_function():
    my_code
    return my_result

What's the correct shortcut to get this done and how can I configure it?


Solution

  • You are correct in that Shift+Tab "tabs backwards". In the PyCharm IDE the language that is used for this is Unindent Line or Selection. My advice is to open your PyCharm Preferences from the file menu and then clicking on the Keymap category on the left side of the newly opened window. View the Editor Actions by dropping down its contents.

    These are all Editor Shortcuts to be used in your IDE. Here you will find Unindent Line or Selection with the current shortcut that is used displayed to its right. Double click to remove its current setting. Double click it again and click "Add _____ Shortcut" to reassign it to your desire.