How to use Emacs to write a C language program and compile and run

Source: Internet
Author: User
Tags apple keyboard

VI and Emacs are respectively known as the editor of God and the editor of God. VI is very difficult to get started, Emacs easy, proficient difficult, vi used to constantly switch mode, and Emacs is constantly ctrl,meta and other key combinations. So the master Gartner says that manipulating Emacs is like playing the organ.

VI is modal, so he rarely uses a combination of keys, editing is really efficient, and I'm tired of the constant mode switch. Emacs was selected. Coincidentally, in foreign countries, almost all the masters are using Emacs, James Gosling (Java language Designer), Donald Knuth (), Jamie Zawinski, Eric Benson. I think real engineers are using Emacs. Emacs is the kind of editor that you can use for 100 years.

Next, you'll learn how to use Emacs to write, compile, and run C programs. (The first statement, this is for beginners to see.) ):

1. After entering Emacs, c-x,c-f find the file or create a new file

Then write the program, such as HELLO.C2. Save the program you wrote, the command is C-x,c-s, 3. Compile the program. Use the command m-x shell or m-x Eshell for Shell mode, then compile with Gcc-wall-o Hello hello.c, and if you do not have GCC installed, first install GCC 5. Switch back to edit: C-x B ' buffername ' can switch to A buffer, if you want to switch back to the hello.c edit area, enter C-x B "Buffername". With the wood found, Emacs is more useful than VI. Second, Emacs button
Vim divides control and editing into two modes, which operate independently of each other. Emacs is both edit and control, but control commands require the use of control keys.
Emacs's control keys are available on three control,shift and Meta,control and Shift keyboards, and Meta is alt in the American keyboard, which is the four-lap key on the Apple keyboard, if there is no alt on the keyboard (This is for some European talent will encounter) can use ESC instead, the other ESC do not want ALT usually when the combination of keys, it should be a separate click, and then press the other.
The control commands are then expressed as follows:
C-f ctrl+f
C-m-f ctrl+alt+f
C-_ ctrl+shift+-

How to use Emacs to write a C language program and compile and run

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.