Getting EAT working well with better colors

This commit is contained in:
Howard Abrams 2026-10-09 19:50:51 -07:00
parent 97e9b86026
commit 82afd54a9c
3 changed files with 62 additions and 10 deletions

View file

@ -124,7 +124,7 @@ I'm not giving up on Eshell, but I am playing around with [[https://github.com/a
VTerm has an issue (at least for me) with ~M-Backspace~ not deleting the previous word, and yeah, I want to make sure that both keystrokes do the same thing. VTerm has an issue (at least for me) with ~M-Backspace~ not deleting the previous word, and yeah, I want to make sure that both keystrokes do the same thing.
#+begin_src emacs-lisp #+begin_src emacs-lisp :tangle no
(use-package vterm (use-package vterm
:config :config
(setq vterm-shell "zsh" (setq vterm-shell "zsh"
@ -162,7 +162,7 @@ An odd use case I have: working in a Terminal session in one buffer window, and
Now, I can type: ~s-G~ (with the shift), select the line with Avy, and type ~N~ to have it copy/paste into the buffer: Now, I can type: ~s-G~ (with the shift), select the line with Avy, and type ~N~ to have it copy/paste into the buffer:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp :tangle no
(use-package vterm (use-package vterm
:config :config
(defun ha-vterm-avy-paste-line () (defun ha-vterm-avy-paste-line ()
@ -180,7 +180,7 @@ Now, I can type: ~s-G~ (with the shift), select the line with Avy, and type ~N~
** Eat ** Eat
While not as fast as [[https://github.com/akermu/emacs-libvterm][vterm]], the [[https://codeberg.org/akib/emacs-eat][Emulate a Terminal]] project (eat) is fast enough, and doesn’t require a dedicate library that requires re-compilation. While offering [[https://elpa.nongnu.org/nongnu-devel/doc/eat.html][online documentation]], I’m glad for an [[info:eat#Top][Info version]]. While not as fast as [[https://github.com/akermu/emacs-libvterm][vterm]], the [[https://codeberg.org/akib/emacs-eat][Emulate a Terminal]] project (eat) is fast enough, and doesn’t require a dedicate library that requires re-compilation. While offering [[https://elpa.nongnu.org/nongnu-devel/doc/eat.html][online documentation]], I’m glad for an [[info:eat#Top][Info version]].
#+BEGIN_SRC emacs-lisp :tangle no #+BEGIN_SRC emacs-lisp
(use-package eat (use-package eat
:straight (:host codeberg :repo "akib/emacs-eat" :straight (:host codeberg :repo "akib/emacs-eat"
:files ("*.el" ("term" "term/*.el") "*.texi" :files ("*.el" ("term" "term/*.el") "*.texi"
@ -192,6 +192,25 @@ While not as fast as [[https://github.com/akermu/emacs-libvterm][vterm]], the [[
:bind (:map eat-semi-char-mode-map :bind (:map eat-semi-char-mode-map
("C-c C-t" . ha-eat-narrow-to-shell-prompt-dwim)) ("C-c C-t" . ha-eat-narrow-to-shell-prompt-dwim))
:config :config
;; Red:
(set-face-attribute 'eat-term-color-1 nil :foreground "#b78077")
(set-face-attribute 'eat-term-color-9 nil :foreground "#d45d4c")
;; Green:
(set-face-attribute 'eat-term-color-2 nil :foreground "#879a39")
(set-face-attribute 'eat-term-color-10 nil :foreground "#66800b")
;; Yellow:
(set-face-attribute 'eat-term-color-2 nil :foreground "#d0a215")
(set-face-attribute 'eat-term-color-10 nil :foreground "#ad8301")
;; Blue
(set-face-attribute 'eat-term-color-2 nil :foreground "#4385be")
(set-face-attribute 'eat-term-color-10 nil :foreground "#205ea6")
;; Magenta:
(set-face-attribute 'eat-term-color-2 nil :foreground "#ce5d97")
(set-face-attribute 'eat-term-color-10 nil :foreground "#a02f6f")
;; Cyan
(set-face-attribute 'eat-term-color-2 nil :foreground "#3aa99f")
(set-face-attribute 'eat-term-color-10 nil :foreground "#24837b")
(defun ha-eat-narrow-to-shell-prompt-dwim () (defun ha-eat-narrow-to-shell-prompt-dwim ()
(interactive) (interactive)
(if (buffer-narrowed-p) (widen) (eat-narrow-to-shell-prompt))) (if (buffer-narrowed-p) (widen) (eat-narrow-to-shell-prompt)))
@ -214,8 +233,6 @@ What about Evil mode?
TODO: Like =eshell=, the Bash in an EAT terminal has a command =_eat_msg= that takes a handler, and a /message/. Then set up an alist of =eat-message-handler-alist= to decide what to do with it. TODO: Like =eshell=, the Bash in an EAT terminal has a command =_eat_msg= that takes a handler, and a /message/. Then set up an alist of =eat-message-handler-alist= to decide what to do with it.
TODO: Need to /subtlize/ the =eat-term-color-bright-green= and other settings as it is way too garish.
Make sure you add the following for Bash: Make sure you add the following for Bash:
#+BEGIN_SRC bash :tangle no #+BEGIN_SRC bash :tangle no

View file

@ -438,6 +438,20 @@ Let’s make a /theme/:
`(term-color-bright-yellow ((t (:foreground ,yellow)))) `(term-color-bright-yellow ((t (:foreground ,yellow))))
`(term-color-bright-cyan ((t (:foreground ,slate)))) `(term-color-bright-cyan ((t (:foreground ,slate))))
`(ansi-color-red ((t (:foreground ,red2-lt :background nil))))
`(ansi-color-green ((t (:foreground ,green-lt :background nil))))
`(ansi-color-blue ((t (:foreground ,blue-lt :background nil))))
`(ansi-color-magenta ((t (:foreground ,purple-lt :background nil))))
`(ansi-color-yellow ((t (:foreground ,yellow-lt :background nil))))
`(ansi-color-cyan ((t (:foreground ,slate :background nil))))
`(ansi-color-bright-red ((t (:foreground ,red2 :background nil))))
`(ansi-color-bright-green ((t (:foreground ,green :background nil))))
`(ansi-color-bright-blue ((t (:foreground ,blue :background nil))))
`(ansi-color-bright-magenta ((t (:foreground ,purple :background nil))))
`(ansi-color-bright-yellow ((t (:foreground ,yellow :background nil))))
`(ansi-color-bright-cyan ((t (:foreground ,slate :background nil))))
`(ansi-color-bright-black ((t (:foreground ,gray-50 :background nil))))
`(sh-heredoc ((t (:foreground ,almond)))) `(sh-heredoc ((t (:foreground ,almond))))
`(sh-quoted-exec ((t (:foreground ,orange2-lt)))) `(sh-quoted-exec ((t (:foreground ,orange2-lt))))

View file

@ -224,6 +224,12 @@ Using the =colorize= plugin (see [[Plugins][plugins section below]]), we customi
export ZSH_COLORIZE_STYLE="coffee" export ZSH_COLORIZE_STYLE="coffee"
#+END_SRC #+END_SRC
While we are at it, let’s make it easier to read the =ls= output:
#+BEGIN_SRC zsh
export LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=33:so=01;35:do=01;35:bd=33;01:cd=33;01:or=31;01:mi=00:su=37:sg=30:ca=00:tw=30:ow=34:st=37:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.jxl=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:"
#+END_SRC
** Language Support ** Language Support
Anything special for particular languages. Anything special for particular languages.
@ -486,8 +492,15 @@ The =EDITOR= variable that some programs use to edit files from the command line
With these variables defined, we can create simple aliases: With these variables defined, we can create simple aliases:
#+BEGIN_SRC zsh #+BEGIN_SRC zsh
alias e="$EDITOR" if [[ -n "$INSIDE_EMACS" ]]
alias te="$EDITOR" then
# If we are already in Emacs, no need to stall the terminal:
e() { emacsclient --eval "(find-file-other-window \"$1\")" }
te() { emacsclient --eval "(find-file \"$1\")" }
else
alias e="$EDITOR"
alias te="$EDITOR"
fi
alias ee="emacsclient --create-frame" alias ee="emacsclient --create-frame"
alias eee="emacsclient --create-frame --no-wait" alias eee="emacsclient --create-frame --no-wait"
#+END_SRC #+END_SRC
@ -496,7 +509,7 @@ With these variables defined, we can create simple aliases:
To work with [[https://github.com/akermu/emacs-libvterm][VTerm in Emacs]], we need to create this function: To work with [[https://github.com/akermu/emacs-libvterm][VTerm in Emacs]], we need to create this function:
#+BEGIN_SRC zsh #+BEGIN_SRC zsh :tangle no
vterm_printf() { vterm_printf() {
if [ -n "$TMUX" ] \ if [ -n "$TMUX" ] \
&& { [ "${TERM%%-*}" = "tmux" ] \ && { [ "${TERM%%-*}" = "tmux" ] \
@ -515,7 +528,7 @@ To work with [[https://github.com/akermu/emacs-libvterm][VTerm in Emacs]], we ne
This allows us to execute Emacs commands: This allows us to execute Emacs commands:
#+BEGIN_SRC zsh #+BEGIN_SRC zsh :tangle no
vterm_cmd() { vterm_cmd() {
local vterm_elisp local vterm_elisp
vterm_elisp="" vterm_elisp=""
@ -529,7 +542,7 @@ This allows us to execute Emacs commands:
For instance: For instance:
#+BEGIN_SRC zsh #+BEGIN_SRC zsh :tangle no
if [[ "$INSIDE_EMACS" = 'vterm' ]] if [[ "$INSIDE_EMACS" = 'vterm' ]]
then then
alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear' alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear'
@ -540,6 +553,14 @@ For instance:
fi fi
#+END_SRC #+END_SRC
** Eat a Terminal
To work with [[:ha-remoting.org::*Eat][Eat]], we need to load up its integration library:
#+BEGIN_SRC zsh :tangle no
[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"
#+END_SRC
The problem with the Eat integration is it prepends a =0= that doesn’t seem to signify anything useful.
* Aliases * Aliases
Assuming we’ve installed [[https://github.com/lsd-rs/lsd][lsd]], let’s make an alias for it: Assuming we’ve installed [[https://github.com/lsd-rs/lsd][lsd]], let’s make an alias for it: