Emacs/Vim UI comparison (for learning)

Hi there,

I have been looking for some information regarding the Emacs UI philosophy. Hopefully, someone here can point me in the right direction for further research. Many thanks in advance!

Background

I am a new (but avid) vanilla Vim user, just getting started with Guix System. My favorite feature of Vim is the overlap between the UI and vimscript. In this way, it is very much like Bash (and other classic shells). With the right approach, just using Vim will teach you the basics of scripting. Since Vim’s UI is modular, studying even very obscure features is rewarding.

Question

I am beginning to see the appeal of LISPs. I think I might be sold on Emacs if it were not for Vim’s code-as-the-interface approach. From what I can tell, Emacs is very keybind-driven. I love keybinds, but REPL-like interfaces are much better for learning. Does that make sense? Can this be had in Emacs?

Well first the Emacs UI is a shell in the sense that bash and Gnome/KDE Plasma are shells, that allow you to interact with your computer. IMHO, the biggest difference between vi/vim and Emacs.

Next it’s a lisp interpreter and most functionality is written in elisp so all keybindings call functions that you can use and even change while emacs is running.

For a REPL you can try:

emacs --batch --eval '(while t (print (eval (read))))'
Loading /etc/emacs/site-start.d/00debian.el (source)...
Lisp expression: (+ 1 3)

4

or in Emacs you can open the REPL with M-x ielm and will get:

or just the regular M-x eshell:

1 Like

Thanks very much. That helps!

My primary concern is that I will just start memorizing keybinds in Emacs without becoming familiar with the underlying functions. M-x feels like a standard command palette which abstracts the UI away from the underlying code. Is there a workflow which helps to expose the functions as you work?

The composability of Vim’s grammar is a real selling point. I want to learn in a hands-on way where I can incrementally add functions to my vocabulary along with new ways to compose them. I have found it worthwhile to avoid plugins, custom functions, and even remaps. Vim’s native vocabulary is extensive and concise enough to do nearly anything without unreasonably long commands. By constraining myself to these commands, I find my understanding grows much faster. This is what I am trying to recreate.

I understand that Emacs takes a different approach. Originally, I was looking for a way to efficiently control Emacs with just Elisp. This is why I am reaching out for your seasoned perspective. What is the best approach to hands-on, incremental learning in Emacs?

Why is that bad? Did you delve deeply into the Vim code to find out what happens when you press j in command mode? That said, you are welcome to do so in Emacs. Press C-h k and then the binding you are interested in, for example C-n. This will open a *Help* buffer with a description of that key. Pressing s in that buffer will take you to the source code for the function next-line (in this example).

Umm… yes? M-x allows you to run “commands”, functions marked as interactive. If you want to run any arbitrary function, you’ll need to use M-: instead. I’m not sure what you mean about “abstracting the UI from the underlying code”… These two keybindings quite literally are the way to run the underlying code. Keybindings are simply keyboard shortcuts tied directly to the underlying functions they run (like next-line from the the previous example).

I’m not sure I fully understand exactly what you mean here, but as a stab at it… at the very bottom, there is a bunch of C code which implements the Emacs Lisp language and some other utilities for optimization purposes (to possibly oversimplify it). There is a layer above that which is all Emacs Lisp which provides the functions necessary to implement Emacs itself. So, to control Emacs with just Emacs Lisp (aka Elisp), just use Emacs. Everything you do is running an Elisp function (mostly… there are some things implemented in C for efficiency, or because of needed hooks to external libraries like GTK for the graphical UI or whatever).

As for an approach to hands-on, incremental learning in Emacs, I might suggest starting with the built-in tutorial (C-h t). You might also consider reading Mastering Emacs (see https://masteringemacs.org). If you are looking to learn the Emacs Lisp language, there is also the manual (C-h i m Elisp RET) or the Emacs Lisp Intro (C-h i m Emacs Lisp Intro RET). If you are looking for examples on configuring Emacs, you are welcome to peruse the code at GitHub - SystemCrafters/crafted-emacs: A sensible base Emacs configuration.. Use the pieces and parts you think fit you the best or adapt them as necessary for your specific configuration of Emacs.

In general, just start using Emacs. As you need to do something, try doing it in Emacs - like writing code, setting up a language server and possibly an LLM for intellisense and code suggestions; try reading email in Emacs (there are several way, I personally use Gnus, others use mu4e, but there are a few other ways to go about it as well); if you need to take notes, try Org mode and possibly one of the second brain implementations like Roam or Denote. Consider following Protesilaos Stavrou on YouTube (https://www.youtube.com/@protesilaos) and possibly read through his configuration - he does a lot of customization without using external packages. And, of course, continue to ask here.

I hope this helps!

1 Like

Thank you for all the direction! You helped clarify the Emacs learning paradigm. I will apply your recommendations and come back with follow-up questions.