PyCharm hotkey to indent/un-indent a line at caret?
Asked Answered
S

2

6

Currently we can move a line up/down by alt+shift+UP and alt+shift+DOWN

Though, when we have moved the line to target position and want to indent it, we have to go to the beginning of the line to tab/shift-tab.

I wonder if we can do that right away at caret position i.e. without having to move to the begin of line.

p.s.

My google results as this page put ctrl+alt+I not work for me.

Squab answered 28/8, 2016 at 15:25 Comment(1)
If you select a single character on the line, tab/shift tab will do the entire line.Feingold
S
16

As @cdbajorin answered, it's just one more step - selecting a character to indent whole line i.e. no-selection will indent text on the right only.

If you select a single character on the line, tab/shift tab will do the
Squab answered 30/8, 2016 at 6:40 Comment(5)
selecting a character is the key, I was used to vs code where just keeping the cursor does the indent work.Konikow
@ChandanNayak What is your point about vscode, I don't get it?Squab
I wanted to say - on vs code I do not have to select any character by just placing the cursor anywhere on the line and hit cmd + }/{ to do the indent. But with pycharm i needed to select a word/character to do the indent. Because it just tabs outward from the cursor with pycharm.Konikow
Got it. Thanks for sharing. But working with Python the opensource way, vscode from microsoft should not be the IDE for us I think.Squab
there is a keymap named "indent Line or Selection",it dont need to select any text @ChandanNayakSubserve
S
1

By default, the tab key execute action "indent Selection",so you must select some text. there is a keymap named "indent Line or Selection", you can use tab as its shortcut.then you dont need to select text (my pycharm version:2020.1.3)

Subserve answered 4/5, 2022 at 3:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.