26

I'm aware of several different vim implementations in Emacs. There's evil-mode, viper, vimpulse and vim-mode. Are there others? How do they compare?

I note that there are a lot of evil-* packages on MELPA, suggesting none of them are 100% feature-complete. What vim features do they provide, and what vim features are missing?

(I'm not interested in the reverse where "a set of vi macros that [are] a fairly full Emacs implementation"!)

Wilfred Hughes
  • 6,890
  • 2
  • 29
  • 59
  • 1
    Perhaps "emulations" would be more correct and less confusing since the goal of the listed modes is giving you the behaviour you desire, not implementing an entire editor on top of Emacs. – wasamasa Oct 16 '14 at 09:10

3 Answers3

35

vi, vip and viper (ordered by creation date) come built-in with Emacs, all of those emulate VI. vim-mode is a newer, stand-alone effort to actually emulate Vim, vimpulse is a set of extras on top of viper to give one the most useful Vim features. evil was created as replacement to vim-mode.

evil is the most recent project and the only one that's actively developed. Its goal is to emulate the editing model of Vim faithfully, leveraging existing Emacs functionality wherever it can. Personally I'd say it's about 90% complete, because a few newish commands (such as gn) are missing, some display-related functionality is fairly hard to recreate (like the display of tildes after the end of a file) and it not implementing a Vimscript interpreter or anything beyond the basics of Ex mode. However it is easier to extend and to introspect than the original, the evil-* extensions are the Emacs equivalent to Vim plugins in nearly all cases (evil-leader for example would be an exception because it's not necessary to offer considering Emacs keymap support).

Considering evil is surpassing Vim at points (see :s and its visual preview or how little effort creating an useful new mode poses), I wholeheartedly recommend it to everyone interested in modal editing for Emacs.

wasamasa
  • 21,803
  • 1
  • 65
  • 97
  • You mentioned `g/` being a newish command in Vim. I've never seen it, and can't find any documentation on it. What does it do in Vim? – ivan Aug 27 '16 at 23:15
  • I'm sorry, I meant `gn`. It turns search results into a text object. Also, it's been implemented by now. – wasamasa Aug 28 '16 at 09:01
  • Ah, I see. I'm glad to hear it's been implemented as I use that one quite a bit in Vim. – ivan Aug 28 '16 at 11:44
10

Since evil is the only actively developed vim emulation mode to my knowledge, I'll make my answer evil-specific. evil is highly usable and very close to a vim-like experience, but there are some vim features that most likely won't be implemented (by design) and some that are incomplete but might be added eventually. Some examples of things that most likely won't be added:

  1. There is no vimscript interpreter, and to my knowledge no plans to implement one.
  2. Incrementing and decrementing numbers (C-a and C-x) won't be added because C-x is too important of an Emacs keybinding.
  3. There is no built-in concept of a leader key; instead, \ is bound to evil-execute-in-emacs-state by default.
  4. C-u isn't bound to scrolling up by default because it's too important as an Emacs keybinding (although you can overwrite this with evil-want-C-u-scroll).

To find a list of vim features that aren't implemented yet (as of the time of writing this answer), the best place to look is the issue tracker. A random sampling of things that are on the list:

  1. Appending a file with ex isn't implemented.
  2. Some motion commands don't behave like vim.
  3. :make isn't mapped to M-x compile.
  4. C-o in insert mode doesn't behave quite like it does in vim.
  5. Swap window buffers isn't implemented.

There are many more, including commands that aren't in the open issue list (especially complicated ex commands), but as you can see from the list they tend to be fairly minor or obscure vim features (vim is a rather large target with which to achieve 100% feature parity).

shosti
  • 5,048
  • 26
  • 33
  • since emacs uses lisp. nothing is impossible. for example, though leader key is not built in, you can install a plugin evil-leader. – chen bin Oct 21 '14 at 01:41
  • @chenbin of course, I was just referring to things that come built-in and enabled by default with evil. – shosti Oct 21 '14 at 03:11
3

The goal of Evil is to emulate Vim, whereas the goal of Viper is to emulate Vi. Vim-mode and Vimpulse are the predecessors of Evil and to my knowledge not developed anymore. The Evil project was started to address shortcomings of these projects.

tmalsburg
  • 2,540
  • 1
  • 14
  • 29