     (evil-insert 1)
     (apply 'insert args))
 
-  (defun eshell/read-history ()
+  (defun eshell/insert-history ()
+    "Prompt for a history item and insert it."
     (interactive)
     (eshell-read-history)
     (sm/eshell-insert (completing-read


  (setq eshell-history-size 10000
        eshell-save-history-on-exit nil ;; This is handled elsewhere.
        eshell-cmpl-cycle-completions nil
        eshell-prompt-function #'sm/eshell-default-prompt
        eshell-prompt-regexp "^.* \\$ ")

  (add-hook 'eshell-mode-hook
            (lambda ()
              ;; Needs to be ran inside the hook since eshell-mode-map is
              ;; buffer local.
              ;;
              ;; See https://github.com/noctuid/general.el/issues/80
              (local-set-key (kbd "C-c h") 'eshell/read-history)))

  ;; Expand !<n> and !!
  (add-hook 'eshell-expand-input-functions #'eshell-expand-history-references)

  :hook ((eshell-mode . sm/add-eshell-aliases)
         (eshell-mode . sm/disable-company)
         (eshell-pre-command . sm/eshell-append-history))
  :bind (("C-c s s" . eshell)
         ("C-c s n" . sm/eshell-new)
         :map eshell-mode-map
         ;; Defaulted to `eshell-complete-lisp-symbol'.
         ("M-<tab>" . completion-at-point)))

(use-package shell
  ;; built-in

(defun sm/disable-company ()
  (company-mode -1))

(defvar sm/eshell-append-history-on-command t
  "Whether or not eshell should write to the history file before each command.")

(use-package eshell
  ;; built-in
