I know that I can change tab size in general using Settings -> Code Style -> Python -> Tab size
But what if I was given a file with tab size 2 and want to change it to 4. Is there a fast way to do it?
The preview tab allows you to view files in a single tab one by one without opening each file in a new tab.
To reopen the closed tab, right-click any tab, and from the context menu, select Reopen Closed Tab. To open a new tab at the end of the already opened one, select the Open new tabs at the end in the tab settings.
Highlight/ select the lines you want indented, then press TAB as often as needed until they reach the proper indent level. You can remove spaces with SHIFT TAB . You can also use CTRL+ALT+I to auto-indent the selection.
If you want to change the tab size, first set the tab size you want in Settings -> Editor -> Code Style -> Python -> Tab size, then re-indent the code you want by selecting it and pressing Ctrl-Alt-L
.
If you want to change the tab size in just one file, you could use Ctrl-R
(find and replace) and replace two spaces by four (or vice versa).
Source: PyCharm documentation - Changing Indentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With