toggle-term.el
is an Emacs package inspired by toggleterm.nvim,
allowing you to spawn a persistent term
, vterm
, eat
, shell
, eshell
, or ielm
at the bottom of the frame and switch between them when needed.
As of 05/26/24 toggle-term.el is part of the MELPA
Just add the following to your init.el
if you already have
the MELPA added:
(use-package toggle-term
:bind (("M-o f" . toggle-term-find)
("M-o t" . toggle-term-term)
("M-o v" . toggle-term-vterm)
("M-o a" . toggle-term-eat)
("M-o s" . toggle-term-shell)
("M-o e" . toggle-term-eshell)
("M-o i" . toggle-term-ielm)
("M-o o" . toggle-term-toggle))
:config
(setq toggle-term-size 25)
(setq toggle-term-switch-upon-toggle t))
(quelpa
'(toggle-term :fetcher github
:repo "justinlime/toggle-term.el"))
(setq toggle-term-size 25)
(setq toggle-term-switch-upon-toggle t)
(require 'toggle-term)
(use-package toggle-term
:quelpa (toggle-term :fetcher github :repo "justinlime/toggle-term.el")
:bind (("M-o f" . toggle-term-find)
("M-o t" . toggle-term-term)
("M-o v" . toggle-term-vterm)
("M-o a" . toggle-term-eat)
("M-o s" . toggle-term-shell)
("M-o e" . toggle-term-eshell)
("M-o i" . toggle-term-ielm)
("M-o o" . toggle-term-toggle))
:config
(setq toggle-term-size 25)
(setq toggle-term-switch-upon-toggle t))
Toggle-term provides the following main functions:
toggle-term-find
- Switch to an active toggle, or create a new one.
toggle-term-toggle
- Toggle the last used toggle.
The follwing helper functions are included for use with keybinds:
toggle-term-term
- Toggle a term, named toggle-term-term
toggle-term-vterm
- Toggle a term, named toggle-term-vterm
toggle-term-eat
- Toggle a eat-term, named toggle-term-eat
toggle-term-shell
- Toggle a shell, named toggle-term-shell
toggle-term-eshell
- Toggle an eshell, named toggle-term-eshell
toggle-term-ielm
- Toggle an ielm, named toggle-term-ielm
toggle-term-size
This can be used to set the size, which is a percentage of the window the toggle will occupy.
This would set the toggle to occupy 25% of the available window:
(setq toggle-term-size 25)
NOTE: values too high, or too low, may cause unexpected behavior
toggle-term-switch-upon-toggle
Determines if the window created by toggle term should be switched to upon spawning:
(setq toggle-term-switch-upon-toggle t)
toggle-term-use-persp
Optionally use perspective integration, automatically enabled when persp-mode is enabled.
(setq toggle-term-use-persp t)
toggle-term-init-toggle
Optionally define an initial toggle that will be the first used
when invoking toggle-term-toggle
.
;; '("name-of-toggle" . type-of-toggle)
(setq toggle-term-init-toggle '("my-terminal" . "term"))
;; or
(setq toggle-term-init-toggle '("my-shell" . "shell"))
;; etc