DEV Community

loading...
Cover image for vim vs. emacs

vim vs. emacs

Harvey
惻2 min read

Vim and emacs are two of the most popular text editors in the world. They are very different, with a different design philosophy.

Vim and Emacs are still used to this day and are both great choices šŸ˜

Vim's main advantage is that it is very good at being a text editor and that you can do a lot without having to learn anything new.

You can install plugins, change key mappings, etc. either with the builtin scripting language or by sourcing scripts from your .vimrc .

Emacs is a text editor but more than that. It can be used for email, browsing the internet and a lot more.

What is vim?

Vim is a modal editor. It operates in either the insert mode (where keystrokes are entered and text is composed) or the command mode (where text can be moved and modified).

It is not until you exit command mode and return to the default, or "normal" mode that the text you have typed will appear on screen šŸ’»

Entering command mode is simple: hit the esc key. Esc takes you back to normal mode and whatever you typed in command mode will be executed.

Most of the commands have a corresponding control key, so for example the command to move the cursor forward one word is w.

To practice vim you can use this site

vim editor

What is emacs?

The emacs editor is very user friendly and easy to pick up especially if you have used other graphical user interfaces (such as those used on Windows and Mac) before using it.

It includes a very handy feature called auto-completion. This allows you to start typing a command and the editor will automatically complete it for you after pressing the tab key a couple times.

emacs

My choice

Iā€™m a vim user. I used to use emacs but moved to vim a couple years ago. I can never go back. My reasons for switching were:

  • Vi/Vim is always installed or available on computers
  • In emacs, the keys are not contiguous. In vim, they are.
  • In emacs, the keys are not in alphabetical order. In vim, they are.
  • I like all my commands to be on a single keystroke (or two). You can get there with a key-chord, but why?
  • Vim is minimalist. I want a program to do one thing (Text editing), not be also an email client, browser etc

Both support keyboard macros, which saves a lot of time.

The design of vim is very simple and extremely efficient, but also very different from what you may expect: there are no appeals to common sense!

For example, instead of having buttons that say "cut" and "copy", you're expected to remember that "d" means "delete".

That may seem strange, but once you get used to it, you never want to go back.

Discussion (0)