ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hey all,
I'm thinking of switcing from VI to Emacs. When I tried to code a C program (hello world ) using emacs, I'm not getting the indentation I get with VI...tabs and stuff. But the parantheses matching is very good. So, any idea how to make `vi-like' indentation work for emacs?
Originally posted by kev82 is it in C or Fundamental mode? when you type the first character on a line it should put it in the correct place, or at least it does for me.
When I start it with something like $ emacs test.c, it says "loading CC mode...done" and I understood that it is in C mode...alright. But with VI, when I type enter after main() {, the next line starts after a tab. Not the case with emacs. It's not a big problem, but I'd love to see emacs behave in the way vi did. I'm particular about the vi style of indentation.
The next line does not start with a tab by default. But, as you enter your code in it, and when you enter either a paranthesis, or semicolon, or some similar chars, the line is automatically indended. This provides a more effective indending mechanism, and also helps sort out some typo errors, atleast for me.
As you work more with it, you will understand its value.
Below is what I have in my ~/.emacs file. It makes emacs use much different colors possible for syntax highlighting, enables auto-indention, auto-newline and auto-backspace. Put this at the end of your ~/.emacs file and retart emacs to check if it is what you are looking for.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.