Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to switch from Vim to Emacs?

Tags:

vim

emacs

People also ask

Is Emacs better than Vim?

Emacs tends to be relatively straightforward, similar to commonly used text editors like Notepad. On the other hand, Vim is a power-user's tool, using keyboard shortcuts to speed up tasks. Vim is known to have a much steeper learning curve than Emacs.

Is Emacs or Vim easier to learn?

Emacs is easier to learn since it has a more natural interface (for users familiar with GUI-based text editors). Since Vim has different editing modes, beginners find it a little harder to learn.

Is Vim more popular than Emacs?

Today, Stack Overflow released its 2018 Developer Survey Results. Vim, the improved version of vi, scored 25.8% in popularity, while Emacs scored a paltry 4.1%. That is a staggering difference.


I would recommend just surviving the accidents until their frequency decreases. I suspect that adding a layer to try to "help" — like one that would try to infer accidental vi commands and perform them — would simply make the transition slower.

I do the same thing when transitioning between, say, version-control systems. Instead of creating a shell-script wrapper that lets me keep using the wrong sub-commands by translating them to the new VCS's idioms, I'd really just rather be forced to "speak the new system's language" cold-turkey.

Remember: you're human; you're built do adapt to new situations. Just keep your wits about you, let the mistakes be mistakes, and you'll do fine.


Practice practice practice. As you probably know from learning Vim, Vim and Emacs fluency comes only with tons of practice until the commands become second-nature. I am a long-time Vimmer and learning Emacs was extremely painful and took months, but nowadays I get by in both just fine. It is worth learning both because Emacs is better than Vim at editing certain languages and doing certain tasks, and vice versa; it's good to have the option of using either. After a while you start to compartmentalize the two mentally and you probably won't have much difficulty (though I still occasionally :wq Emacs and C-/ Vim, it doesn't happen often enough to be a problem).

  • Read the Emacs documentation thoroughly. A lot of the terminology and functionality of Vim and Emacs is similar but just different enough to make it all confusing. The tutorial is a good start but the Emacs manual is a treasure trove of best-practices and configuration tips.

  • The Emacs wiki is your friend. When you come across an Emacs feature that you absolutely can't accept, there is usually a way to configure the problem away.

  • C-h a is also your friend. Much like :h is indispensable in Vim, the Emacs help system is a great boon in navigating Emacs' enormous set of builtin commands. There are many ways to search the documentation to find what you want; this page has a good summary.

  • Don't use viper or vimpulse, at least not at first. Emacs will never be as good a Vim as Vim. Immerse yourself in Emacs until you get used to it. The Emacs way of doing things is very different but it has strengths (and weaknesses) of its own compared to the Vim set of keybindings. Learn them both so you can see those strengths and weaknesses and make an informed decision. Nowadays I have borrowed a bunch of Emacs shortcuts and mapped them in Vim, and vice versa.

  • Take it slow. When (not if) Emacs starts to make you foam at the mouth in rage, take a break, hop into Vim and come back later. It's going to take a while.

Keep in mind that you don't need to "switch". You aren't going to forget Vim and replace it in your brain with Emacs. If you know Vim and you learn Emacs, then you will know both. This is a good thing.


Have you tried Emacs's viper-mode?


The duration and intensity of the Vim versus Emacs debate suggests rather strongly that both editors are about equal in their usefulness. If you already know vi, you may as well stick with it.


I think it depends on your motivation for learning Emacs.

If you have just a casual interest in learning Emacs, viper-mode is probably the way to go because it may not be worth the pain and frustration of having to retrain your muscle memory. You can still have access to all the great Emacs functionality, but customize your experience based on which level of viper you choose.

If you want to learn because you want to have a completely customizable editor, then I'd pick a task you think might be fun to work on and use that to motivate the Emacs usage. This kind of experience would be completely unique to you. In which case, I'd recommend going cold-turkey and just expect a couple of days of pain and frustration.


I don't have any experience with this (I use Vim) but Vimpulse is an Emacs script to emulate Vim (as apposed to Viper-mode which emulates vi). That would probably make the transition easier.


As a fellow convert, and erstwhile vim user, I highly recommend viper-mode. It's not perfect, but it will give you most of the vi/vim keybindings. You'll learn the few commands that you're used to in vim (IME, mostly ones that start with 'g') without too much difficulty.

In general, I really feel that this is the best way to use Emacs. The vi keybindings are really, really efficient, and I think that for a lot of the things that I do in a text-editor (simple movement commands, simple commands involving moving, deleting, changing, searching, etc.) the vi model is much more streamlined and efficient compared to Emacs. I can totally understand why someone not already familiar with Emacs wouldn't want to use viper-mode, but as someone coming from vim, you really have the opportunity to get the best of both worlds.

In general: get used to the fact that viper-mode isn't perfect, learn how to do the things you're missing from it the Emacs way, and make sure you explore the cool features that Emacs has that aren't available in vim.

As for using vimpulse, I tried it out when I first switched, and I wouldn't really recommend it. Since it's a major mode you'll be missing out on a lot (most?) of the good parts about Emacs; and it's still not 100% faithful to vim anyways. It's really much better to take viper-mode for what it is, and move on.