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:
Henrik Lissner 2019-06-12 17:10:10 +02:00
parent 77a7b76108
commit b2da28edfe
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 15 additions and 4 deletions

View file

@ -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