By: Graffiti – Zi Han

Come doodle work: job.tuya.com/


Emacs and Vim, the two main editors, have always made it difficult to choose between successive tools. Emacs is called the editor of the Gods, and Vim is the editor of the gods. The ace that pursues alone the world people witnessed their elegant demeanour, after seeing their simple and thin interface, can not help but heart gives birth to a doubt, is this the artifact? Some people have contempt for them, even sneer at them. There are also those who bravely try to learn, but because the learning curve is steep and long, give up before appreciating its powerful inner beauty. But there are some who stick around and watch.

I have been working hard for nearly 5 years, from Vim to Emacs.

Why Vim/Emacs

During my college years, WHEN I was working on Linux in virtual machines, I used Vim to edit many configuration files, so I got to know Vim. I just thought the editor opened files so fast. Behind the net to see the operation of Vim god, flowing water, mercury, can not help heart yearning. I happened to use Vim at work, so I was hired by Amway. At that time, I thought it was cool to write code with pure keyboard instead of mouse (I also thought my speed and efficiency of writing code were too low, so I had to make some efficient things).

After that, I had to configure vim’s plug-ins. Compared with the atom and Subline I used before, I felt that I needed the most functions in my project, so I went to find such plug-ins. Then I went to the Internet to see how the big god used Vim, and why they used some functions that ViM did not have by default. Bit by bit, adapt, digest, absorb. In the beginning, I was actually writing code slower, but I was able to stick with it.

Then I gradually felt that VIm was still really not good-looking, and there was no good-looking and useful editor. At this time, I saw Spacemacs on the Internet and got to know it. It turned out to be the famous Emacs, and I saw some operations of Emacs, and felt it was really difficult to use. Spacemacs was able to use Vim in Emacs, and was intrigued by her theme at the time and decided to give it a try. As I learned, Spacemacs combed through the original emacs buttons and shortcuts to avoid some of the problems of using the original Emacs. Plus, I was reading some FP stuff at the time when SPACemacs was being configured to write Lisp, so I stuck with it. Spacemacs uses Vim’s editing mode by default, so it fits well into the editing process.

The advantages of Emacs

Emacs is an operating system masquerading as an editor. Emacs is a Lisp interpreter that, thanks to its powerful FFI, can call external dynamic libraries. Vim’s script VimScript doesn’t have this, and Vim needs Python to do something similar.

Emacs configuration and extensions are written in Lisp, and Lisp supports REPL, making it easier to write and debug plug-ins and extensions. What is Lisp? It’s also a very viable programming language. Before C was invented, MIT’s Artificial Intelligence Lab wrote ITS operating system partly in assembly language and partly in Lisp. Today, Lisp is still widely used in artificial intelligence research. With such an awesome extension language, Emacs is destined to be omnipotent. Increasingly, Emacs is not just for writing programs and documents, but also for managing file systems, running terminals, checking email, surfing the Internet, listening to music… It just spiraled out of control. Some people even use Emacs to control the coffee machine.

The Emacs plugin evil allows the use of Vim in Emacs. Vim’s strength lies in its design philosophy. Vim divides the input into two parts: pure input and operation. Pure input is the input of pure characters, which needs to be operated when moving the cursor or copying and pasting. These two parts of the switch is through mode switching, its operation makes pure input more efficient, so vim is called the god of editors. Emacs will be even more powerful when it has vim editing mode! But Vim is having a hard time porting Emacs’ capabilities.

Emacs editorial Philosophy

When Emacs edits files, different plug-ins do different things. When it opens file, it will have 1 major mode plus n minor modes. For example, when we open a TS file, typescript-mode supports TS syntax and so on, while highlight-mode highlights its TS keyword, flycheck-mode checks your English spelling, Lsp-mode completes the buffer, display-line-numeres-mode displays or hides the line numbers of the buffer, and indent-line-mode controls the indentation, etc. The advantage of this is that you can not only switch your major mode, but also have the flexibility to switch on and off each minor mode. For example, when ts files are large and typescript-mode can be slow, you can switch to text-mode to open files much faster. You can even control whether to use major-mode and minor-mode on or off based on the file’s stat.

Org – a powerful mode

A lot of Emacs were cratered because of org, and even some of the biology and chemistry classes were cratered because of ORG. The benefits of org are too numerous to list. Of course, VimWiki is good, but it’s not as good as org. You can say org = VimWiki + markdown. Basically, org can do everything VimWiki and Markdown can do, and vice versa.

Amazon used to document not in Word or Markdown, but org.

  1. org table

  1. org todo

  1. org source block

  1. org capture

  1. org agenda & calendar

I can quickly locate my TODO from CalendarI can also check my schedule for today, tomorrow, the day after tomorrow, this week and next week from calendar

Org is more powerful than that. (Github and GitLab support markdown and org by default)

Some of the features of emacs I’m using

  1. Clojure’s cider

Cider provides a repL, and you can connect to a Clojure repL to execute some code or debug remote code, etc. As shown below, I run a Lein repl locally and then connect it to execute some functional code.

  1. lsp

It’s not just VS-code or IDE completion that works well, since The LSPS were introduced by Microsoft’s hard dad, any editor completion code protocol has been uniform, and now vim Emacs supports this as well, vS-Code completion code is the LSP. Of course, Microsoft also introduced dap, and ReactX, such as RXJS. Can not help but want to say a big hard dad, strong ah!!

  1. mu4e

Emacs can also serve as a client for receiving mail. The picture above shows

Emacs can also view images, PDFS, and web pages. Definitely your treasure boy/girl, you deserve it!!

Let’s have a picture at the end!

I love Vim, but I love Emacs even more


Come doodle work: job.tuya.com/