This package adds syntax highlighting to the Emacs Eshell. It highlights user commands at the interactive prompt to provide feedback on the validity of commands and syntax.
This package is inspired by zsh-syntax-highlighting and the native highlighting of fish.
This package is installable through MELPA. After setting up the MELPA package archive, install with
M-x package-install RET eshell-syntax-highlighting RET
Alternatively, with use-package:
(use-package eshell-syntax-highlighting
:after eshell-mode
:ensure t ;; Install if not already installed.
:config
;; Enable in all Eshell buffers.
(eshell-syntax-highlighting-global-mode +1))
Use (eshell-syntax-highlighting-global-mode)
to toggle highlighting in all future Eshell buffers.
You can toggle highlighting in an existing buffer with (eshell-syntax-highlighting-mode)
.
Since elisp in remote directories will run locally, high-latency TRAMP connections can cause significant typing delays while the local Emacs session makes requests of the remote machine (such as searching the remote PATH, checking if remote files exist, etc.). Therefore, highlighting in remote directories is disabled by default. It can be enabled by setting eshell-syntax-highlighting-highlight-in-remote-dirs
to t
.
Faces in this package inherit from standard faces to match your theming. If this results in ambiguous highlighting (e.g. your font-lock-function-name-face
is red), or if you just want to customize the coloring, you can use
M-x customize-group eshell-syntax-highlighting
to customize the faces used by this package.