Index Emagician Base Install Meta Interface Programming Text Org Lamp Journal Snippets jonnay.netFork on Github

Eshell Magick

Table of Contents

1 About the name…

If this file is called, it weaves into eshell.el, and then require gets problematic.

(add-hook 'emacs-startup-hook 'eshell)

2 Fixes

2.1 Jigger path so that jamf won't break shit

jamf adds a symlink to the path, which makes completion barf when starting eshell.


So we will jiggery poke the path.

(setenv "PATH"
        (replace-regexp-in-string ":/usr/local/bin/jamf"
                                                (getenv "PATH")))

2.2 Execute an eshell Command Programmatically Thank you wasamasa

(defun emagician/eshell-command (cmd) 
  (with-current-buffer "*eshell*"
     (insert cmd)

2.3 Use helm for history

(use-package eshell
  :bind (:map eshell-mode-map
         ("M-S-r" . helm-eshell-history)))

2.4 Fix an issue with running commands remotely through tramp

This is apparently still an issue.

(defadvice eshell-gather-process-output (before absolute-cmd (command args) act)
  (setq command (file-truename command)))

(add-to-list 'tramp-remote-path 'tramp-own-remote-path)

2.5 Pager 😻

Use cat as a pager. Fixes all kinds of things.

(setenv "PAGER" "cat")

3 Interface

3.1 Set Prompt

(use-package eshell-prompt-extras
  (setq eshell-highlight-prompt nil
        eshell-prompt-function 'emagician/epe-theme))

3.2 Use my own theme

(defun emagician/epe-theme ()
  "Emagician Eshell Prompt Extras theme."
  (setq eshell-prompt-regexp "^[^#\n🐰]*[#🐰]) ")
   (epe-colorize-with-face "\n" 'mode-line)
   (when (epe-remote-p)
     (epe-colorize-with-face "[ Remote ]"
   (epe-colorize-with-face (eshell/pwd) 'epe-dir-face)
   (when (epe-git-p)
      (epe-colorize-with-face ":" 'epe-dir-face)
       (concat (epe-git-branch)
               (let ((unpushed (epe-git-unpushed-number)))
                 (unless (= unpushed 0)
                   (concat ":" (number-to-string unpushed)))))
   (epe-colorize-with-face "\n 🐰)" 'epe-symbol-face)
   (epe-colorize-with-face (if (= (user-uid) 0) "#" "") 'epe-sudo-symbol-face)
   " "))

3.3 Did you mean?

(use-package eshell-did-you-mean 

3.4 Show fringe

(use-package eshell-fringe-status
  (add-hook 'eshell-mode-hook 'eshell-fringe-status-mode))



Thank you wasamasa

Author: Jonathan Arkell

Created: 2018-05-18 Fri 10:30