68 lines
3.4 KiB
Text
68 lines
3.4 KiB
Text
;;;;;
|
|
title: There is an Evil in your Emacs
|
|
tags: emacs, vim, editors
|
|
date: 2014-07-01 21:44
|
|
format: md
|
|
;;;;;
|
|
|
|
When I first started using GNU/Linux I was looking for a proper text
|
|
editor. I only had any experience with Visual Studio on Windows
|
|
because I was a .Net developer at the time, and didn't really have
|
|
much of a choice. One of the main things I wanted was an editor that
|
|
worked in a terminal.
|
|
|
|
Naturally I came to Vim and Emacs (as well as Nano, and perhaps some
|
|
others as well). For a few weeks I kept switching between Vim and
|
|
Emacs. I liked Vim's syntax highlighting better, but on the other hand
|
|
I liked Emacs' keybindings/modelessness better as well. I ended up
|
|
going with Emacs mostly because of Vim's moded editing.
|
|
|
|
For years the thought of Vim's moded editing gave me nightmares. I
|
|
never really realised the best thing about Vim. Even when a post
|
|
appears on Stack Overflow about grokking Vim. I was already so blinded
|
|
by the idea that Emacs was the superior editor for me that I failed to
|
|
register the information. It took a long time, but eventually I opened
|
|
up to the possibility of such moded editing. By now I was stuck with
|
|
Emacs because I just couldn't give up its customizability or
|
|
extensibility. Also, I've grown to love Lisp, and specifically Emacs
|
|
Lisp, so to go from that to Vimscript wouldn't be quite ideal.
|
|
|
|
Eventually I decided I really did want to try it. Thankfully Emacs has
|
|
a package for that: Evil, the Extensible Vi Layer for Emacs. There is
|
|
one other problem, though: I use the Colemak keyboard layout. The
|
|
usual `hjkl` keys are more like `hynu`, with the up key at the bottom
|
|
of the keyboard, down at the top and left and right diagonally from
|
|
eachother. Again Emacs has a package for that, `colemak-evil`. It
|
|
rebinds some of the keys so that Evil will work with the Colemak
|
|
keyboard layout. It is based on that the creator of the Colemak layout
|
|
used to use in Vim. It's a bit aggressive, so I customized it to be a
|
|
little less so, mostly removing rebindigs from the motion and emacs
|
|
state maps.
|
|
|
|
The real power is in the composability of the commands. In Emacs you
|
|
have commands like `forward-kill-word`, `forward-kill-sexp` and
|
|
`forward-kill-char`. In Vim you have the `delete` operation, which can
|
|
be combined with, for example, the `forward-word` motion, or the
|
|
`next-line` or `forward-char` motion. I probably have the names wrong,
|
|
but hopefully they convey the meaning of what they do. This is what it
|
|
is all about, or at least from what I've learned to use so far. Of
|
|
course the powerful ed-like editing features called forth through the
|
|
Vim `ex` mode, such as `%s/find/replace`. Lastly, of course, the fact
|
|
that a lot of editing can be done in normal mode helps in preventing
|
|
Emacs-pinky.
|
|
|
|
I haven't yet been able to work with the extensible part, but some of
|
|
the modules that exist for evil speak volumes of it.
|
|
|
|
If you are interested in increasing your productivity, or you like to
|
|
experiment with new things, you might really want to try it. It may
|
|
not completely be Vim, but it's still completely Emacs. If you use the
|
|
colemak-evil package as well you'll also notice that in the insert
|
|
state all your regular Emacs keys work normally, which is a great
|
|
combination of the two editors. So far I feel that Vim is great for
|
|
editing existing code and text, but Emacs still feels better when
|
|
writing a lot of new code or text.
|
|
|
|
<!-- Local Variables: -->
|
|
<!-- mode: markdown -->
|
|
<!-- End: -->
|