Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs changing c coding style

Tags:

c

linux

emacs

How do i change the c coding style format in emacs ? Specifically i need to change the indentation in the c code shown by emacs from i per block to 2 per block

like image 472
Malice Avatar asked Jul 29 '26 10:07

Malice


2 Answers

Type M-x followed by "customize-mode" followed by "c-mode". Then use the built-in customization page to override the default "C Basic Offset" with your new value of "2". When you're done, be sure to select "Save for future sessions" at the top of the page.

like image 131
Rakis Avatar answered Jul 31 '26 02:07

Rakis


Among the built-in indentation styles, "gnu" has an indentation width of 2 characters. You can choose an indentation style with c-set-style, bound to C-c..

like image 33
Rörd Avatar answered Jul 31 '26 02:07

Rörd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!