Revert to initial evil state on term popup toggle
i.e. switch to insert state and move cursor to prompt.
This commit is contained in:
parent
77a7b76108
commit
b2da28edfe
3 changed files with 15 additions and 4 deletions
|
@ -98,7 +98,10 @@ project (or if prefix ARG was present)."
|
|||
(let (confirm-kill-processes)
|
||||
(delete-window win)
|
||||
(ignore-errors (kill-buffer eshell-buffer)))
|
||||
(select-window win))
|
||||
(select-window win)
|
||||
(when (bound-and-true-p evil-local-mode)
|
||||
(evil-change-to-initial-state))
|
||||
(goto-char (point-max)))
|
||||
(with-current-buffer (pop-to-buffer eshell-buffer)
|
||||
(if (eq major-mode 'eshell-mode)
|
||||
(run-hooks 'eshell-mode-hook)
|
||||
|
@ -110,7 +113,7 @@ project (or if prefix ARG was present)."
|
|||
(setq default-directory target-project)
|
||||
(with-silent-modifications
|
||||
(goto-char (point-max))
|
||||
(when (re-search-backward eshell-prompt-regexp)
|
||||
(when (re-search-backward eshell-prompt-regexp nil t)
|
||||
(delete-region (match-end 0) (point-max)))
|
||||
(eshell-send-input))))
|
||||
(when command
|
||||
|
|
|
@ -29,7 +29,10 @@ If prefix ARG, recreate term buffer in the current project's root."
|
|||
(if (multi-term-dedicated-exist-p)
|
||||
(if (eq (selected-window) multi-term-dedicated-window)
|
||||
(multi-term-dedicated-close)
|
||||
(select-window multi-term-dedicated-window))
|
||||
(select-window multi-term-dedicated-window)
|
||||
(when (bound-and-true-p evil-local-mode)
|
||||
(evil-change-to-initial-state))
|
||||
(goto-char (point-max)))
|
||||
(multi-term-dedicated-open)))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -21,7 +21,11 @@ If prefix ARG is non-nil, recreate vterm buffer in the current project's root."
|
|||
(if-let (win (get-buffer-window buffer-name))
|
||||
(if (eq (selected-window) win)
|
||||
(delete-window win)
|
||||
(select-window win))
|
||||
(select-window win)
|
||||
(when (bound-and-true-p evil-local-mode)
|
||||
(evil-change-to-initial-state))
|
||||
(goto-char (point-max)))
|
||||
(require 'vterm)
|
||||
(let* ((default-directory (or (doom-project-root) default-directory))
|
||||
(buffer (get-buffer-create buffer-name)))
|
||||
(with-current-buffer buffer
|
||||
|
@ -38,6 +42,7 @@ If prefix ARG is non-nil, cd into `default-directory' instead of project root."
|
|||
(user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm"))
|
||||
(when (eq major-mode 'vterm-mode)
|
||||
(user-error "Already in a vterm buffer"))
|
||||
(require 'vterm)
|
||||
;; This hack forces vterm to redraw, fixing strange artefacting in the tty.
|
||||
(save-window-excursion
|
||||
(pop-to-buffer "*scratch*"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue