HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
Evil Mode: Or, How I Learned to Stop Worrying and Love Emacs

thoughtbot · Youtube · 5 HN points · 10 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention thoughtbot's video "Evil Mode: Or, How I Learned to Stop Worrying and Love Emacs".
Youtube Summary
Aaron Bieber from Wayfair is back to talk to us about his recent experience using Emacs (what?!?!). That's right, Emacs. Aaron decided it was time to see how things looked on the other side and will share what he found, what he missed from Vim, and maybe even a few things we can bring back to Vim from Emacs.

Learn more from the developers at thoughtbot ⌨️
Head over to http://tbot.io/dev-blog to read more great articles on our blog.
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
You may enjoy https://youtu.be/JWD1Fpdd4Pc, presented by someone who hopped over from Vim.
"Evil Mode: Or, How I Learned to Stop Worrying and Love Emacs" by Aaron Bieber is an interesting talk on switching from vim to emacs + org-mode.

https://www.youtube.com/watch?v=JWD1Fpdd4Pc

rossvor
Thanks, I just watched the video, and it did intrigue me enough to install spacemacs to start playing around with it.

Having "real" spreadsheet like tables within my wiki does look appealing. I do in fact already have a bunch of small spreadsheets doing some very basic stuff, and it does make more sense for them to be within the wiki itself.

Emacs has recently been seeing a lot of growth from vim users who are migrating to emacs "distros" (like spacemacs and doom) that are pre-configured with emacs' vim-emulation.

I found this video[0] a pretty interesting perspective from a die-hard vim user who switched.

[0]: https://www.youtube.com/watch?v=JWD1Fpdd4Pc

alpaca128
I've tried those already. Evil, Spacemacs, Doom. All except Doom have a misbehaving Escape key, Spacemacs needs as long to start up as one of the Electron-based editors.

In the end it comes down to this: I don't need Emacs. I've tried to find a feature that I really want and that's worth it to switch for(yes, I also tried org mode). But I'm comfortable with my Vim setup, I don't need an email client or web browser in the text editor.

It sounds counter-intuitive to use another editor, especially Emacs, but this might actually be the best advice. Emacs is on top of the game for proportional text editing, as well as the ability to make it behave very much (even exactly so) like Vim.

I'd recommend watching this talk for why: https://www.youtube.com/watch?v=JWD1Fpdd4Pc

Jun 11, 2018 · moistoreos on Neovim 0.3 released
I have a serious question: If Emacs has a lot of the features people seek in Neovim, why not just use Emacs in evil mode? I watched this earlier today so it seemed relevant: https://youtu.be/JWD1Fpdd4Pc

Side note: I've been using Neovim for months now and I've not tried Emacs. Not because I don't want to but because Vim with the plugins i have works really really well.

Carpetsmoker
I tried it a few years ago and found a lot of stuff quite confusing.

Emacs does a lot of stuff better than Vim, but Vim is more than "good enough" for me, and it's not really worth the time/effort to learn a lot of stuff over again.

syrrim
Evil mode doesn't support most ex mode commands. Can be jarring for someone used to doing things the vim way. Eg :help is just a thin wrapper around emacs' native help system, no :sets work, :u isn't implemented, etc.
Aug 05, 2017 · 3 points, 0 comments · submitted by tosh
Aug 17, 2016 · 1 points, 0 comments · submitted by wtbob
I don't know NixOS, but this blog post and lecture might help you give emacs a fair trial:

http://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-... https://www.youtube.com/watch?v=JWD1Fpdd4Pc

One of my vim-using coworkers found it. He, along with another colleague, have since found emacs compelling enough to use as their main text editor.

akkartik
Unfortunately those instructions failed out of the gate at this command in .emacs:

  (require 'package)
The error I get is:

  File error: "Cannot open load file", "package".
I installed emacs on OS X using:

  $ brew install emacs
But it looks like version 24.5 on OS X El Capitan doesn't come with something called 'package.el'. Oh well, back to Vim..
ics
Are you sure that you launched the correct emacs? (`M-x version RET` in Emacs to check) This is an extremely common error for people using the built-in version which, as of El Capitan, is still Emacs 22.1 (almost 10 years old).
akkartik
Ack, you're right! I installed it, added a symlink to the head of my path, but forgot to open a new terminal so continued using the old hashed path.

Edit 10 minutes later: Ok, it's installed now. And I've set this up in my .zshrc:

  -alias vi=vim
  +alias vi=emacs
Let's see how this goes.
mijoharas
If you want a little more terminal magic here are my emacs related shortcuts:

  alias et='TERM=xterm-256color emacsclient -t'
  alias ec='emacsclient -c -a=emacs'
  alias ed='emacs --daemon'
  alias kill-emacs='emacsclient -e "(kill-emacs)"'
  alias e='TERM=xterm-256color f -e "emacsclient -c -a=emacs"'
The reason for these is that emacs is a little slow to start up (in comparison to vim at least). So you can set up a daemon running ( ed command above, for emacs daemon. I don't have ed on my system)

You can then open up a new frame (window) of emacs with the ec command, or a new terminal session of emacs with the et command.

My favourite is the e command, which makes use of fasd[0] to find any "frecent" file, tries to open it with emacsclient, but, if emacs daemon is not running will fall back to opening a new emacs (which with spacemacs will start a new daemon running). This way I can open files in completely different directories if need be.

[0] https://github.com/clvv/fasd

akkartik
Thanks for those tips! Just to contribute back a factoid in case you weren't aware, I noticed that the manpage for emacsclient says this:

"If the value of [the alternate editor] is the empty string, run `emacs --daemon' to start Emacs in daemon mode, and try to connect to it."

So your aliases would continue to work if you replace -a=emacs with -a=''. And you'd only pay the startup cost the first time you run ec or e.

seagreen
Thanks, this is encouraging.
akkartik
I spent a couple of days trying it out exclusively before giving up. Really nice all-in-all to keep me using it for so long, but eventually I ran into some big issues:

A) evil-mode doesn't support :next and :prev for navigating between filenames given on the commandline.

B) Emacs's mindset towards indentation fundamentally seems incompatible with Vi's.

  - Emacs
  RET - indent current line, then create new one
  TAB - indent current line

  - Vim
  RET - create new line and add indent to it
  TAB - insert some characters at point (nowhere else)
I tried to spend some time configuring it, but it's too hard to catch every language minor mode. Hitting tab sometimes moves forward two spaces, sometimes to the next mod-8 column and sometimes indents the current line, refusing to do anything else if it's already correct to Emacs's puny mind. It doesn't look like evil-mode is able to patch all the places this mindset leaks through.

A particularly egregious example is in the lisp minor-mode. Try this on a vanilla Emacs install without any startup files (I used v24.5.1 on OS X):

1. $ emacs x.lisp

2. Type in '; abc'. That's a lisp comment with a single comment leader semi-colon.

3. Hit enter.

The line gets right-justified to column 40 (5 tabs) before the cursor moves to the next line.

Apparently Emacs thinks all full-line comments in lisp should start with ';;'.

Needless to say, this behaves the same way even with evil-mode. I spent some time trying to track it down, but RET is just bound to vanilla newline, not indent-and-insert-newline or something like that. So I'll stop here.

lispm
> Apparently Emacs thinks all full-line comments in lisp should start with ';;'.

Not exactly. ;; aligns to the current indentation level of the code.

It's a usual Lisp indenting convention.

The Emacs Lisp manual recommends:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Co...

Common Lisp uses it also. See the ANSI CL spec.

2.4.4.2.1 Use of Single Semicolon

Comments that begin with a single semicolon are all aligned to the same column at the right (sometimes called the “comment column”). The text of such a comment generally applies only to the line on which it appears. Occasionally two or three contain a single sentence together; this is sometimes indicated by indenting all but the first with an additional space (after the semicolon).

2.4.4.2.2 Use of Double Semicolon

Comments that begin with a double semicolon are all aligned to the same level of indentation as a form would be at that same position in the code. The text of such a comment usually describes the state of the program at the point where the comment occurs, the code which follows the comment, or both.

2.4.4.2.3 Use of Triple Semicolon

Comments that begin with a triple semicolon are all aligned to the left margin. Usually they are used prior to a definition or set of definitions, rather than within a definition.

2.4.4.2.4 Use of Quadruple Semicolon

Comments that begin with a quadruple semicolon are all aligned to the left margin, and generally contain only a short piece of text that serve as a title for the code which follows, and might be used in the header or footer of a program that prepares code for presentation as a hardcopy document.

akkartik
Wow, I can't believe I didn't know this after all this while hacking lisp. Many thanks.
You might find this article useful: http://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-...

Aaron gave a great talk about his switch here: https://www.youtube.com/watch?v=JWD1Fpdd4Pc , which caused several people at work to move off NeoVim and give emacs a go.

pjmlp
Thanks for the links it was interesting to watch as a former Emacs fan.

In the old days, Emacs alongside DDD was the only way for me to get some of the Borland IDE comfort in UNIX land.

Aug 27, 2015 · 1 points, 0 comments · submitted by tambourine_man
Jul 23, 2015 · blaenk on What's new in Magit 2.x
TL;DR: Watch this video: the stated reasons for switching are very similar to my own. It wasn't until I watched this video and read the book that I took the plunge to switch to emacs. It was the fact that with emacs I could have vim _plus_ much more and better functionality. https://www.youtube.com/watch?v=JWD1Fpdd4Pc

I'll have to write a blog post about it sometime, but basically while I absolutely _love_ the vim 'editing interface', that is, not the GUI, but the modal editing, the bindings, motions, objects, relative line numbers, and so on, everything else aside from that, primarily plugins, always felt like ad-hoc hacks to me. I've contributed to a couple of vim plugins so I've seen it first hand, to the point where plugin authors I've worked with have expressed feelings of wanting to switch to emacs to just make things easier. Indeed, some have, such as the vim-airline author [ http://bling.github.io/blog/2013/10/27/emacs-as-my-leader-vi... ].

Whereas plugins in vim oftentimes gave me the impression that they were stopgaps and hacky workarounds to get vim to do something it wasn't meant to do, emacs packages feel very natural, comprehensive, and well designed. Just take this article for example. As awesome as vim-fugitive is for vim, I feel that it's good _for being a vim plugin_, but it has _nothing_ on the equivalent on emacs: magit. Take a look at it's comprehensive documentation: http://magit.vc/ Or flycheck's [ http://www.flycheck.org/ ] documentation here [ http://www.flycheck.org/manual/latest/index.html ]

It seems like everyone puts up with everything else about vim just to have the good parts of vim that are generally very poorly emulated by other editors. The evil package for emacs changed that for me, as it's the most faithful vim emulator I've seen. Now I have a superset of vim; the vim that I love in an environment that is _much_ more suitable for my development workflow: magit, error checking, tags, searching, and more.

If you're just a vim user, you probably don't really think about or realize what you're missing out on by not using emacs. One of my favorite things about emacs that the book really emphasizes is that it is completely self-documenting. Every function, every key binding, every command, every variable, everything is documented and easy to find. Vim of course has `:help` as well, but emac's documentation is on an entirely different level. I can press `C-h k` for example, then press a binding on my keyboard, and it'll tell me what command I have it bound to, what that command does, and it'll have a link to the source code for that command that opens in emacs with syntax highlighting and everything. Of course I can also do the reverse: find what key a command is bound to; in fact I can search my bindings as I type using helm-descbinds. I can search emacs documentation easily with the `apropos` command and its variants. Oftentimes in vim I generally only looked things up only after I already knew _what_ to look up, whereas in emacs I can easily explore things on my own and figure things out.

Emacs has much better extensibility features in general. In vim sometimes I would find something a plugin did that I wanted to work differently, and I pretty much only had two options: 1) file PR and hope the author agrees with my changes or adds them in optionally or 2) fork the plugin. 2 was out of the question because I didn't want the maintenance burden of maintaining a fork, and 1 was too much trouble sometimes for simple modifications or were simply too opinionated to realistically be accepted by the author. So pragmatically I just treated plugins as set-in-stone. With emacs I have much more options at my disposal ranging from advising [ http://www.gnu.org/software/emacs/manual/html_node/elisp/Adv... ], hooks, and in the worst case just redefining symbols with emacs lisp.

I was and still am hopeful for Neovim, but it'll take ages for it to catch up to emacs in terms of robustness and ecosystem, let alone similar feature set of emacs (which is probably a non-goal of neovim anyways). It's just an entirely different 'environment' in the sense of features and packages available to you.

I wonder if in the future we could leverage neovim's API functionality to have completely true vim bindings/editing within emacs. That would be the absolute best case scenario that I could imagine.

That said, I definitely believe that the default emacs bindings are horrible. I at first wanted to try to go cold turkey, 100% emacs, but the editing in emacs is just horrible to someone like me familiar with the speed and precision of vim editing, so I gave in and used evil, which is amazing. That saying about emacs being "a great operating system, lacking only a decent editor" rings very true to my ears, and with evil I have both.

I, as a Vim user myself, recently saw this and decided to give emacs a try. I still have a long way to go but I have to say that it really does look like it might be the best of both worlds.

https://www.youtube.com/watch?v=JWD1Fpdd4Pc

HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.