Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace all tab characters in a file by sequences of white-spaces in intellij?

Given a file in my project, I want to be able to replace all of the tab characters in the file with white spaces. Is there any way to do this in intellij?

like image 823
Jeremy W Avatar asked Sep 12 '14 20:09

Jeremy W


People also ask

How do I show whitespace characters in IntelliJ?

To enable this feature in IntelliJ, you must open the Settings dialog ( Ctrl+Alt+S ) and navigate to the Editor | General | Appearance tab. In this tab you need to enable the Show whitespace option. In addition, you can individually enable/disable which whitespaces to show: leading, trailing or inner.

How do you fix file contains tab characters This is the first instance?

To fix this Navigate to Preferences > Java > Code Style > Formatter. Then click on New > give name for the formatter > click on ok .


2 Answers

Go to Edit | Convert Indents , and then choose To Spaces or To Tabs respectively. It's in the documentation: Changing identation

like image 55
Vasile Jureschi Avatar answered Sep 21 '22 17:09

Vasile Jureschi


Replace only tabs used for indentation

  • Ctrl + Shift + A
  • type "To Spaces" > Enter

    To Spaces

Replace all tabs

  • Ctrl + R
  • check Regex
  • Enter \t and spaces
  • Replace all

    Replace tab with 4 spaces

like image 41
ROMANIA_engineer Avatar answered Sep 21 '22 17:09

ROMANIA_engineer