11

I use PhpStorm/IntelliJ. It is configured to indent using spaces by default because I use PHP's PSR-2 standard a lot. I don't want to change the default indentation settings.

However I want to write makefiles and they require to use tabs for indentation.

How can I write makefiles in PhpStorm/IntelliJ with spaces as default indentation?

Matthieu Napoli
  • 48,448
  • 45
  • 173
  • 261
  • *"It is configured to indent using spaces by default because I use PHP's PSR-2 standard a lot."* 1) PSR-2 is for PHP; 2) PHP has own settings for tab/space which will override those from general tab. Solution seems obvious for me: use Spaces in General and Tabs for PHP – LazyOne Sep 12 '15 at 17:20
  • Other possible solution is to use [EditorConfig](http://editorconfig.org/), which IntelliJ supports. – Bohuslav Burghardt Sep 12 '15 at 17:21
  • @LazyOne I don't want to change the global settings. PSR-2 was just an example, I use spaces for indentation everywhere and don't want to change that. – Matthieu Napoli Sep 13 '15 at 21:45
  • @MatthieuNapoli In such case you will have to go via `.editorconfig` files -- it should be working AFAIK (it supports some set of general editor settings for files (by extension) even if there is no dedicated Code Style for such files). Just be careful with such files (in general) -- by their nature such settings will override settings that you have set in Code Style in PhpStorm. – LazyOne Sep 13 '15 at 22:53

1 Answers1

2

1) By now, there is a Makefile plugin for PhpStorm.

If you use this plugin and create a Makefile, it will automatically use tabs.

2) Another solution is to change the Makefile not to use tab as prefix. However, I do not like this solution very much because it requires a newer version of gmake which makes it less portable.

Sybille Peters
  • 2,832
  • 1
  • 27
  • 49