         (cd (projectile-project-root))
       (user-error "Not in project")))
 
+  (defun eshell/clear ()
+    "Clear the eshell buffer."
+    (let ((inhibit-read-only t))
+      (erase-buffer)
+      (eshell-send-input)))
+
   (defun seanmacs/eshell-insert (&rest args)
     (goto-char (point-max))
     ;; Only reset prompt if there's already some input.

              ;; buffer local.
              ;;
              ;; See https://github.com/noctuid/general.el/issues/80
              (local-set-key (kbd "C-c h") 'eshell/read-history)
              (local-set-key (kbd "C-c d") 'eshell/find-subdirectory-pwd)
              (local-set-key (kbd "C-c p") 'eshell/find-subdirectory-project)))

  :hook ((eshell-mode . seanmacs/add-eshell-aliases)
         (eshell-pre-command . seanmacs/eshell-append-history)))


  (defun eshell/read-history ()
    (interactive)
    (eshell-read-history)
    (seanmacs/eshell-insert (completing-read
                             "History: "
                             (mapcar #'string-trim
                                     (delete-dups
                                      (ring-elements eshell-history-ring))))))

  (setq eshell-history-size 10000
        eshell-save-history-on-exit nil ;; This is handled elsewhere.
        eshell-cmpl-cycle-completions nil
        eshell-prompt-function #'eshell-default-prompt
