From b38912364b6b75986204e4c7ebb48b72505fd852 Mon Sep 17 00:00:00 2001 From: Gregor Grigorjan Date: Fri, 4 Oct 2024 13:19:50 +0300 Subject: [PATCH] feat(emacs): add `gg/vterm-new-with-name` function --- modules/nixos/programs/emacs/init.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/nixos/programs/emacs/init.el b/modules/nixos/programs/emacs/init.el index b1b0947..2a296e1 100644 --- a/modules/nixos/programs/emacs/init.el +++ b/modules/nixos/programs/emacs/init.el @@ -617,19 +617,26 @@ (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) (use-package vterm - :init - (add-to-list 'display-buffer-alist - '("\\*vterm*" - (display-buffer-at-bottom)))) -(use-package vterm-toggle :init (defun gg/vterm-new () (interactive) - (vterm-toggle--new)) + (vterm 'new)) + (defun gg/vterm-new-with-name (buffer-name) + (interactive "MName for vterm buffer: ") + (other-window -1) ;; Hack, because the window takes up the fullscreen if we invoke `vterm' from the minibuffer + (vterm (format "*vterm-%s*" buffer-name))) + (add-to-list 'display-buffer-alist + '("\\*vterm*" + (display-buffer-at-bottom))) :general (gg/leader - "o o" #'vterm-toggle-cd "o n" #'gg/vterm-new + "o N" #'gg/vterm-new-with-name)) + +(use-package vterm-toggle + :general + (gg/leader + "o o" #'vterm-toggle "o j" #'vterm-toggle-forward "o k" #'vterm-toggle-backward))