Disable auto-indentation of C++ files


#1

Hi all,

I came across an issue that in some specific cases Atom indents C++ files I am editing although I think I turned any and all auto-formatting.

One example is that the space after if is removed and the next line is indented with 4 spaces instead of 2:

if(...)
    values[local_index] = 1.;

Settings->Editor->Auto Indent / Auto Indent on Paste are turned off.
I have language-c and language-cpp+14, but the same setting is also turned off there.

I would appreciate any help to figure out why the file gets indented.

p.s. the file is auto-detected ad C++14.

Regards,
Denis.


#2

The language-cpp14 package’s default settings have tabLength set to 4, so I find it strange that you’re seeing two-space tabs elsewhere.


#3

I am not sure this is related. I don’t use tabs at all, the problem is that I have

if (...)
  blabla;

that is, there is space after if and two spaces before blabla, and this gets indented to what I showed in the OP.


#4

Does this happen if you open Atom from the command line with atom --safe?

Whether you use tabs or spaces doesn’t matter. Indentation levels function nearly identically. tabLength is the number of character columns used by an indentation level.

and this gets indented to what I showed in the OP.

And what action do you perform that results in the indentation occurring?