Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij: how to convert indents for all files

I know how to convert indent for a single file. I go to edit -> convert indent -> space/tab.

But I want to do this for all files under a directory.

I try click on a directory and then go to edit -> convert indent, but the options are grayed out.

enter image description here

like image 433
user2628641 Avatar asked Mar 05 '23 23:03

user2628641


1 Answers

You can use the shortcut Ctrl+ALT+L (Windows/Linux) or ⌥⌘+L (MAC OS X) and select the Rearrange entries option to reformat the code in the current file or reformat a module or directory.

You can also Right-click a module, file, or directory from the context menu and select Reformat Code and also select the Rearrange entries option.

This will convert the indents for all files/directories selected:

enter image description here

This works on most of the Jetbrains IDES (iDea, PyCharm, WebStorm, RubyMine, and so on.)

like image 101
valdeci Avatar answered Mar 10 '23 12:03

valdeci