Skip to content

Latest commit

 

History

History
120 lines (96 loc) · 3.11 KB

Eshell-Magick.org

File metadata and controls

120 lines (96 loc) · 3.11 KB

Eshell Magick

About the name…

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

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

Fixes

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")))

Execute an eshell Command Programmatically [fn:1]

(defun emagician/eshell-command (cmd) 
  (with-current-buffer "*eshell*"
     (eshell-return-to-prompt)
     (insert cmd)
     (eshell-send-input)))

Use helm for history

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

Fix an issue with running commands remotely through tramp

http://emacs.stackexchange.com/questions/2107/run-application-in-cwd-on-remote-host-from-within-eshell

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)

Pager 😻

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

(setenv "PAGER" "cat")

Interface

Set Prompt

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

Use my own theme

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

Did you mean?

(use-package eshell-did-you-mean 
  :demand
  :config
  (eshell-did-you-mean-setup))

Show fringe

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

Footnotes

[fn:1] Thank you wasamasa