Eshell

It is a shell written in Emacs Lisp. Eshell is both a command shell and an Emacs Lisp REPL (Read Eval Print Loop), as a result, you can invoke commands in two different ways: command form or in Lisp form.

As always, the official documentation provides you with more than enough information on Eshell.

Figure 1: Eshell

Figure 1: Eshell

Command form

Command form looks much the same as in other shells. A command consists of arguments separated by spaces; the first argument is the command to run, with any subsequent arguments being passed to that command.

Figure 2: eshell command form

Figure 2: eshell command form

Lisp form

Lisp form looks like ordinary Emacs Lisp code, because that’s what it is. As a result, you can use any syntax normally available to an Emacs Lisp program.

Figure 3: eshell elisp form

Figure 3: eshell elisp form

Customization

Standard I/O works well in eshell, but ncurses interfaces like htop and nano won’t run in it; we can tell eshell to run such commands in AnsiTerm instead, which is a full emulated VT100 terminal.

1
(append '("htop" "vim" "ssh") eshell-visual-commands)

Note that usually this is already appended, see the output of variable eshell-visual-commands to find out what already included.

1
eshell-visual-commands

Completion

esh-autosuggest

Fish-like history autosuggestions in eshell1.

1
2
3
4
5
6
(use-package esh-autosuggest
  :hook (eshell-mode . esh-autosuggest-mode)
  ;; If you have use-package-hook-name-suffix set to nil, uncomment and use the
  ;; line below instead:
  ;; :hook (eshell-mode-hook . esh-autosuggest-mode)
  :ensure t)