Easily switch between & create new shell buffers.
Conch provides a unified interface for managing shell buffers in Emacs. It supports multiple shell backends including eshell, shell, term, and vterm.
Disclaimer: This is hella vibe coded.
- Not in a shell buffer, no shells exist: Create a new shell
- Not in a shell buffer, shells exist: Switch to a shell
- In a shell buffer, another shell exists: Switch to it
- In a shell buffer, no other shells: Do nothing
- With prefix argument (
C-u): Always create a new shell
The simplest way to install conch.el is by using use-package with the :vc keyword:
(use-package conch
:vc (:url "https://github.com/marlonschlosshauer/conch.el" :rev :newest))Conch provides dedicated commands for each shell type:
| Command | Description |
|---|---|
conch-eshell |
Switch/create eshell buffers |
conch-shell |
Switch/create shell-mode buffers |
conch-term |
Switch/create term buffers |
conch-vterm |
Switch/create vterm buffers |
conch |
Use the default backend |
;; Bind each shell type to a key
(global-set-key (kbd "C-c e") #'conch-eshell)
(global-set-key (kbd "C-c s") #'conch-shell)
(global-set-key (kbd "C-c v") #'conch-vterm)
;; Or use the generic command with a configured default
(setq conch-default-backend 'vterm)
(global-set-key (kbd "C-c t") #'conch)(use-package conch
:bind (("C-c e" . conch-eshell)
("C-c s" . conch-shell)
("C-c v" . conch-vterm))
:custom
(conch-default-backend 'eshell)) ;; optionalconch-default-backend- The shell backend used by theconchcommand. Options:eshell,shell,term,vterm. Default:eshell.
You can add support for other shell types by extending conch-backends:
(add-to-list 'conch-backends
'(my-shell . (:mode my-shell-mode
:create my-shell
:create-new (lambda () (my-shell t)))))Each backend requires three properties:
:mode- The major mode symbol:create- Function to create or switch to a buffer:create-new- Function to always create a new buffer