Home>
I want to achieve

I am writing a C language program on Linux CentOS.
For example, in C language

#include<stdio.h>
int main (void)
{
    int n;
    scanf ("% d",&n);
    printf ("n = \ n", n);
    return 0;
}


I'm trying to write a program like
When you start a new line from {under int main

int main (void)
{
int n;
...


If i do nothing, it will be like this.
Of course, if you press the Tab key, you can write beautifully.
However, it's a hassle to press the Tab key every time to align the lines.
Is there a way to align the lines without pressing the Tab key every time?
please tell me.

int main (void)
{
   int n;
...
}
  • Answer # 1

    You can do this by adding a setting to automatically indent ~/.emacs.

    https://shammerism.hatenadiary.com/entry/20080523/1257609692

  • Answer # 2

    If you go around with "emacs auto indent", various articles will appear, so why not read through it?