Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change tab size in a specific file in Pycharm

Tags:

python

pycharm

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?

like image 609
Legonaftik Avatar asked May 12 '16 11:05

Legonaftik


People also ask

Does PyCharm have tabbed view?

The preview tab allows you to view files in a single tab one by one without opening each file in a new tab.

How do I add a tab in PyCharm?

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.

How do you tab all lines in PyCharm?

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.


1 Answers

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

like image 108
Sam van Kampen Avatar answered Sep 29 '22 08:09

Sam van Kampen