diff options
Diffstat (limited to '.config/emacs/modules/bd--shells.el')
-rw-r--r-- | .config/emacs/modules/bd--shells.el | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/.config/emacs/modules/bd--shells.el b/.config/emacs/modules/bd--shells.el index 22860b3..9a8301f 100644 --- a/.config/emacs/modules/bd--shells.el +++ b/.config/emacs/modules/bd--shells.el @@ -3,10 +3,41 @@ ;;; Code: -(with-eval-after-load "term" (defalias 'term 'ansi-term)) - (add-to-list 'exec-path "/home/bdunahu/.local/bin") +(use-package vterm + :config + (with-eval-after-load "term" (defalias 'term 'vterm)) + ;; use vterm for visual visual commands + (defun bd/eshell-exec-visual (&rest args) + "Run the specified PROGRAM in a vterm emulation buffer. +ARGS are passed to the program. At the moment, no piping of input is +allowed." + (let* (eshell-interpreter-alist + (interp (eshell-find-interpreter (car args) (cdr args))) + (program (car interp)) + (args (mapconcat #'shell-quote-argument + (flatten-tree + (eshell-stringify-list (append (cdr interp) + (cdr args)))) " ")) + (term-buf + (generate-new-buffer + (concat "*" (file-name-nondirectory program) "*"))) + (eshell-buf (current-buffer)) + (vterm-shell (concat (shell-quote-argument + (file-local-name program)) + " " args))) + (save-current-buffer + (switch-to-buffer term-buf) + (vterm-mode) + (setq-local eshell-parent-buffer eshell-buf) + (let ((proc (get-buffer-process term-buf))) + (if (and proc (eq 'run (process-status proc))) + (set-process-sentinel proc #'eshell-term-sentinel) + (error "Failed to invoke visual command"))))) + nil) + (advice-add #'eshell-exec-visual :override #'bd/eshell-exec-visual)) + (use-package esh-module :config (add-to-list 'eshell-modules-list 'eshell-smart)) @@ -22,7 +53,8 @@ (use-package em-term :config (add-to-list 'eshell-visual-commands "nethack") - (add-to-list 'eshell-visual-commands "r2")) + (add-to-list 'eshell-visual-commands "r2") + (setopt eshell-destroy-buffer-when-process-dies t)) (use-package em-prompt :config |