Add support for multi-vterm

This commit is contained in:
Joshua Wood 2022-10-10 21:56:13 -04:00 committed by Maxi Wolff
parent b5e75bc65f
commit 33743922eb
4 changed files with 40 additions and 0 deletions

View File

@ -3560,6 +3560,7 @@ files (thanks to Daniel Nicolai)
- function: =spacemacs/make-variable-layout-local=
(thanks to JAremko and duianto)
- Better keybindings for ~ESC~ and ~RET~ in vterm =evil-normal-state= (thanks to kenkangxgwe)
- Added support for multi-vterm as default terminal option
**** Shell Scripts
- Added new company-shell environment variable backend
(thanks to Alexander-Miller)

View File

@ -35,6 +35,7 @@
- [[#multi-term][Multi-term]]
- [[#eshell-1][Eshell]]
- [[#vterm][vterm]]
- [[#multi-vterm][Multi-vterm]]
* Description
This layer configures the various shells available in Emacs.
@ -118,6 +119,7 @@ to the following variables:
- =term=
- =ansi-term= (default on Linux/macOS)
- =multi-term=
- =multi-vterm=
- =vterm=
#+BEGIN_SRC emacs-lisp
@ -294,6 +296,7 @@ Some advanced configuration is setup for =eshell= in this layer:
| ~SPC a t s e~ | Toggle pop-shell with =eshell= |
| ~SPC a t s i~ | Toggle pop-shell with =shell= |
| ~SPC a t s m~ | Toggle pop-shell with =multi-term= |
| ~SPC a t s M~ | Toggle pop-shell with =multi-vterm= |
| ~SPC a t s t~ | Toggle pop-shell with =ansi-term= |
| ~SPC a t s T~ | Toggle pop-shell with =term= |
| ~SPC a t s v~ | Toggle pop-shell with =vterm= |
@ -324,6 +327,7 @@ in the current buffer instead of a popup.
| ~SPC m n~ | go to next multi-term |
| ~SPC m N~ or ~SPC m p~ | go to previous multi-term |
** Eshell
| Key binding | Description |
@ -346,3 +350,12 @@ For example with bash
(shell :variables
spacemacs-vterm-history-file-location "~/.bash_history")
#+END_SRC
** Multi-vterm
| Key binding | Description |
|------------------------+----------------------------|
| ~SPC m c~ | create a new multi-vterm |
| ~SPC m n~ | go to next multi-vterm |
| ~SPC m N~ or ~SPC m p~ | go to previous multi-vterm |
| ~SPC m r~ | rename vterm buffer |

View File

@ -75,6 +75,7 @@ Additionally changes to working directory when the value of
`shell-pop-autocd-to-working-dir' is non-nil (default)."
(interactive)
(let ((shell (cl-case shell-default-shell
('multi-vterm 'multivterm)
('multi-term 'multiterm)
('shell 'inferior-shell)
(t shell-default-shell))))
@ -241,6 +242,11 @@ is achieved by adding the relevant text properties."
(interactive)
(multi-term))
(defun multivterm (&optional ARG)
"Wrapper to be able to call multi-vterm from shell-pop"
(interactive)
(multi-vterm))
(defun inferior-shell (&optional ARG)
"Wrapper to open shell in current window"
(interactive)

View File

@ -43,6 +43,7 @@
terminal-here
vi-tilde-fringe
window-purpose
(multi-vterm :toggle (not (spacemacs/system-is-mswindows)))
(vterm :toggle (not (spacemacs/system-is-mswindows)))))
@ -368,6 +369,25 @@
(with-eval-after-load 'centered-cursor-mode
(add-hook 'vterm-mode-hook 'spacemacs//inhibit-global-centered-cursor-mode)))))
(defun shell/init-multi-vterm ()
(use-package multi-vterm
:defer t
:init
(progn
(make-shell-pop-command "multivterm" multivterm)
(spacemacs/set-leader-keys "atsM" 'spacemacs/shell-pop-multivterm)
(spacemacs/register-repl 'multi-vterm 'multi-vterm))
:config
(progn
(setq vterm-shell shell-default-term-shell)
;; multi-term commands to create terminals and move through them.
(spacemacs/set-leader-keys-for-major-mode 'vterm-mode
"c" 'multi-vterm
"n" 'multi-vterm-next
"N" 'multi-vterm-prev
"p" 'multi-vterm-prev
"r" 'multi-vterm-rename-buffer))))
(defun shell/post-init-window-purpose ()
(purpose-set-extension-configuration
:shell-layer