eshell-p10k
is, as the name implies, an eshell version of p10k (a popular shell theme).
Everything else should already come with emacs
Coming Soon™
Add in the load-path somewhere after the dependencies
Some point after eshell
has loaded (ideally), use the following options to load the prompt
(setq eshell-prompt-function #'eshell-p10k-prompt-function
eshell-prompt-regexp eshell-p10k-prompt-string)
Much like p10k itself, it’s possible to change all the start/end/separator characters.
Variable | Default |
---|---|
eshell-p10k-separator | “\xe0bc” |
eshell-p10k-start-terminator | “\xe0b2” |
eshell-p10k-end-terminator | “\xe0b0” |
Any characters should work but haven’t been tested
This package includes a somewhat sane prompt out of the box, but also includes a number of tools to create our own segments.
Let’s take a go at our own segment(using an existing face for simplicity)
(eshell-p10k-def-segment time
""
(format-time-string "%H:%M" (current-time))
'eshell-distro-face)
The eshell-p10k-def-segment
macro takes the following basic form:
(eshell-p10k-def-segment segment-name
icon-to-use
body
face)
segment-name
is the defined name of the segment, which will be later used when we define the prompt functionicon-to-use
is the icon which will get prepended to the start of the form. Can also be an expression.body
is the … body of the segment, which gets evaluated to produce the output. A result ofnil
will cause the segment to not be displayed.face
is the face used to display the segment. Can also be an expression.
Now the segment has been created, the prompt definer (eshell-p10k-prompt-function
) has to be modified
(defun eshell-p10k-prompt-function ()
"Prompt defining function."
(eshell-p10k-def-prompt '(distro dir git prompt-num time)))
And after everything has been re-evaluated, we have the below prompt!
- This article gave me the fundamentals to create the skeleton for this
- doom-modeline for the concept of split segments and adding checks around said segments
- p10k for the inspiration and (and the icons)