A unified Emacs package for sending code to shell buffers with support for multiple backends: shell, vterm, eat, and ghostel.
- Multiple shell backends: Support for shell, vterm, eat, and ghostel
- Buffer-specific shell buffers: Each source file gets its own dedicated shell buffer
- Flexible code sending: Send selected regions or current blocks to shell
- Minimal dependencies: Only depends on Emacs built-in packages (with optional shell backends)
Clone the repository and add to your Emacs load path:
(add-to-list 'load-path "~/.emacs.d/site-lisp/send-to-shell.el")
(require 'send-to-shell)The primary entry point for send-to-shell is the interactive command:
(send-to-shell)This shows an interactive menu where you can select:
- A shell backend (shell, vterm, eat, ghostel)
- An action (start or switch to shell, send region or block, or send current line)
Send a region of text to the specified shell backend.
(send-to-shell-send-region (point-min) (point-max) 'shell)Send the current paragraph/block to the specified shell backend.
(send-to-shell-send-block 'vterm)Send the active region if one exists, otherwise send the current block.
(send-to-shell-send-region-or-block 'shell)Send the current line to the specified shell backend.
(send-to-shell-send-current-line 'shell)Start or switch to the shell buffer for the current source buffer.
This command must be called from sh-mode.
(send-to-shell-start-shell 'shell)List available backends:
(send-to-shell-get-available-backends)
;; Returns: (shell vterm eat ghostel) based on what's installedSet the default backend:
(setq send-to-shell-default-backend 'vterm)Adjust sleep time for vterm (in milliseconds):
(setq send-to-shell-vterm-sleep-ms 150)Each source buffer gets a dedicated shell buffer using the pattern *<source-buffer-name>*. For example:
script.sh→ shell buffer*script.sh*Makefile→ shell buffer*Makefile*
Traditional comint-based shell. No external dependencies required.
Full terminal emulator. Requires emacs-libvterm package.
Terminal emulator implementation. Requires eat package.
The package is loaded on demand when available.
Alternative terminal backend. Requires ghostel package.
Add to your Emacs configuration to set up key bindings:
;; Open send-to-shell menu
(global-set-key (kbd "C-c C-s") 'send-to-shell)
;; Or register the built-in sh-mode bindings
(send-to-shell-register-sh-mode-keybindings)
;; Equivalent sh-mode bindings installed by the helper above:
;; C-c C-s -> send-to-shell
;; C-c C-z -> start or switch to shell
;; C-c C-n -> send current line
;; C-c C-c -> send region or blockWhen using the transient menu, the Start or switch to shell action
selects the shell window after opening or switching to it.
See LICENSE file in the repository.
