Terminal Velocity: Eshell, vterm, and Eat

Updates

Comparing Emacs Terminals and Shells

If you’re an Emacs fan and haven’t been using it as your terminal of choice, you’ve been missing out!

In this stream, we’ll take a look at three different options you should consider for a terminal (or terminal-like) experience in Emacs:

We will experiment with these three options to see which one gives the best results based on the following factors:

  • Speed
  • Terminal emulation quality
  • Efficiency/ease of use

We’ll quickly try to come up with a decent configuration with each of them and then experiment to see what kind of results we get!

Eshell

Pros

  • Nice prompt editing experience
  • You can run Emacs commands from the shell prompt
  • Easy redirect of command output to Emacs buffers
  • Supports Windows and emulates Linux-style shell commands in that environment!

Cons

  • Not a full POSIX shell so some things work differently (subcommands, piping, etc)
  • Output can be really slow for some things like ls on large folders. (Though you still can drop through to the real commands with *ls etc
  • It’s not a terminal emulator, so terminal programs don’t render correctly (though you can use eshell-visual-commands to defer specific programs to term-mode)

vterm

Pros

  • Great in terms of speed and terminal emulation completeness
  • You can use Emacs inside of Emacs (but not easily)
  • You can use vterm_cmd inside of your shell to invoke Emacs commands

Cons

  • Requires some extra Bash (or other) shell configuration to make it blend with Emacs more effectively (directory tracking, key bindings, etc)
  • Not easy to have separate modes for passing through certain keys directly to the terminal app
  • Tricky to use with Evil Mode
  • You need some compiler dependencies to use it on most systems!
  • It doesn’t support Windows

Eat

Pros

  • Does not require compiled components
  • Does seem to emulate the terminal pretty well
  • Better key binding modes to control how keypresses get sent to the terminal
  • Handy eat-project command

Cons

  • Have some issues with the cursor jumping upward when using TAB for completions (sometimes)
  • Not as fast as vterm, but still not bad
  • Also requires some shell integration, but it’s easy to set up, pretty much automatic (directory tracking, etc)

Eshell + Eat - The best of both worlds?

Pros

  • You can run full terminal applications from within Eshell!
  • You still have full integration with Emacs, no shell integration scripts needed on the Eat side
  • You have full Emacs-driven prompt editing and display

Cons

  • You still aren’t using a POSIX shell (Eshell) so you might get confused and expect certain things to work like Bash (subcommands, piping, etc)

Note: It’s possible to do something similar with vterm and the eshell-vterm package: https://github.com/iostapyshyn/eshell-vterm

The final configuration

(use-package eat
  :ensure t
  :config
  (eat-eshell-mode)
  (setq eshell-visual-commands '()))

~/.emacs.d/eshell/alias

alias ls *ls $*
alias cp *cp $*
Subscribe to the System Crafters Newsletter!
Stay up to date with the latest System Crafters news and updates! Read the Newsletter page for more information.
Name (optional)
Email Address