Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use emacs to write C language

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to use emacs to write C language". In daily operation, I believe many people have doubts about how to use emacs to write C language. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "how to use emacs to write C language". Next, please follow the editor to study!

Vi and emacs are called the editor god and the god editor respectively. It is difficult to get started with vi, easy to get started with emacs, but difficult to master; vi keeps switching modes, while emacs keeps ctrl,meta and other key combinations. Therefore, Master Gartner said that operating Emacs is like playing the organ.

Vi has patterns, so he rarely uses key combinations, which is really efficient to edit, and I'm tired of constantly switching modes. Emacs is selected. Coincidentally, in foreign countries, almost all masters use emacs, James Gosling (Java language designers), Donald Knuth (), Jamie Zawinski, Eric Benson. I think real engineers use Emacs. Emacs is the kind of editor that you can use for 100 years.

Next, we introduce how to use emacs to write, compile and run c programs. (just to be clear, this is for beginners.) :

1. After entering emacs, CmerxMagic Cmurf (meaning press ctrl+x first and then press ctrl+f) to find the file or create a new file

Then write a program, such as hello.c

two。 Save the program written, and the command is Cmurxmae Cmurs, (press ctrl+x first, then press ctrl+s)

3. Compiler. Use the command Mmurx (alt+x) shell or Mmurx eshell for shell mode, and then use gcc-Wall-o hehe hehe.c to compile. If gcc is not installed, install gcc first.

5. Switch back to the editing area: Cmurx b 'buffername' can switch to a certain buffer. If you want to switch back to the hehe.c editing area, type CMRIX b "buffername" (for example, press ctrl+x and then enter b and then enter hehe.c). Have you noticed that emacs is much easier to use than vi?

2. Emacs button

Vim divides control and editing into two modes, which operate separately and do not affect each other. On the other hand, Emacs is edited and controlled at the same time, but the control command requires the use of control keys.

Emacs control keys on the three Control,Shift and Meta,Control and Shift keyboards are available, Meta in the American keyboard is Alt, in the Apple keyboard is the very fancy four-circle key, if there is no Alt on the keyboard (this will be encountered by some Europeans) can use Esc instead, in addition Esc does not want Alt usually used as a combination of keys, it has to press alone, and then press another.

Later, the control command will say:

Cmurf Ctrl+f

C-M-f Ctrl+Alt+f

Cmure _ Ctrl+Shift+-

At this point, the study on "how to use emacs to write C language" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report