Hacker News new | ask | show | jobs
by mheathr 4665 days ago
I use both Vim and Emacs, and in most contexts Evil-Mode within Emacs that emulates most of Vim's vanilla functions.

Emacs also has modal editing that allows for per mode based keybindings.

Where Vim wins out though on the keybinding game is with its grammar that enables a great deal of mnemonics and the ability to bind keys based on key sequences that do not all have to be prefix keys except for the last key in the sequence, which is the case with Emacs currently.

That opens up a lot more options for generating terse keybinds that are simply not possible with the way Emacs binding system currently works, and coming from Vim I found the system extremely confusing until I read how Emacs keymaps lookups work in greater detail.

That spills over into what is possible with Evil-Mode bindings as well to a degree because of the prefix key requirement with the sequences.

And in Emacs, because of its keymap hierarchy system it is extremely easy to have custom keymaps shadowed and overruled by a higher ranking mode mapping, which again coming from Vim is not obvious what is happening there and how to overcome that behavior.

Even though I now grok how Emacs processes keymaps, I still much prefer Vim's system that allows for any key sequences to be interleaved to make very terse sequences.

The workaround to the situation with long chord sequences that use the Meta and Control keys is that I will bind the frequently used command to the hyper or super keys which are largely not used by modes nowadays and are much less crowded as a result.

There is no inherent reason why Emacs could not move towards a key sequence rather than a chord sequence binding scheme, so resolving the quagmire is at least tractable.

I do use Emacs chords where they are reasonable though rather than changing states just to interact with a REPL or a VCS mode, and in the context of working with Lisp I always use Emacs' chords as paredit obviates the need for any of Vim's grammar, which by default lacks a sexp object or ways of transposing objects well.