How can i configure Atom to auto-indent on custom keywords?


#1

When i write a c++ class and use private or public Atom sets these words automatically one tab back.
Is there a way to configure these rules?
currently a class would look like this:

class Abc
{
public:
int doSomething()


#2

ok i mistakenly submitted this question before i was done with it…

class Abc
{
public:
   int doSomething()
   {
      return 0;
   }
};

What i want should look like this:

class Abc
{
   public:
   int doSomething()
   {
      return 0;
   }
};

#3

This is controlled by the settings of the language-c package. The increaseIndentPattern setting tells Atom to increase the indent following a line that matches the pattern and the decreaseIndentPattern decreases the indent on the matched lines (you can see how the brackets behave). So just add this to your config.cson to override the built-in setting:

'.source.c, .source.cpp, .source.objc, .source.objcpp':
  'editor':
    'decreaseIndentPattern': '(?x)
       ^ \\s* (\\s* /[*] .* [*]/ \\s*)* \\}
      |^ \\s* (\\s* /[*] .* [*]/ \\s*)* \\)
      '