How can I use real tabs, not spaces.


Here is the scenario:

Tab size is 5 and naturally my tab locations are at 5,10,15,20,25,30,35,40 and so on.

If I write abc and press tab, I got 2 spaces instead of a real tab with a size of 2 space. And if I continue press tab, all consecutive tabs are converted to spaces.

I changed Tabs and Indents settings, tried all the combinations but none seem to work. There must be a setting somewhere that I don't know because this is such a simple feature even the simplest text editors has. When I press the tab, I need a real tab from my current cursor location to the closest tab location.

How can I do that?


Comment actions Permalink
Official comment



1. You can set this in Settings(Preferences on Mac) > Editor > Code Style > PHP(or any other file type you're working with):

After that you can go to Settings > Editor > General > Appearance > tick "Show whitespaces". This would allow to see if a code is indented with spaces or tabs:



Comment actions Permalink

Most people use spaces instead of tabs because different people set their tabs to different sizes. As a result, a different developer sees code that isn't lined up. That's why most modern IDEs and text editors do all kind of "smart" things with tabs and spaces.

Comment actions Permalink

OK probably I couldn't explain the situation clearly. I'll try again:

Dmitry, my goal is not see which character is used for indent. I already know that. Even if I check the "Use tab character" setting, still space is used instead of real tab.

Let me explain like this:

My tab size is 5. I write abc and press tab 10 times. In other editors (e.g. Windows Notepad and Notepad++) I need to press backspace 10 times to clear the tabs and go back to abc. In PS, I need to press backspace 42 times because there are no tabs, all spaces.

I get tabs only in start of every line. If I write something and and try to indent, all become spaces.

Here is how it works in other editors: Tab size is 5. I write abc and press tab. That tab size becomes 2. 

Hope this makes sense.

Comment actions Permalink

Hi there,

1. Please provide some sample file (share it somewhere, not just paste content here) and specify at what lines/columns you are trying to use Tab and it inserts spaces for you

2. Please provide your Code Style schema (File | Export Settings)

3. Do you use EditorConfig support plugin?

Comment actions Permalink

Andriy, YES! Finally!

Installed the EditorConfig, and set 

indent_style = tab
indent_size = 5

Problem solved.


Thank you!

Comment actions Permalink

EditorConfig overrides Code Style settings (by its' nature).

If you are happy with your current solution then no problems. Otherwise please provide #1 and #2.


Please sign in to leave a comment.