Make eshell and vterm keybindings projectile-aware

This commit is contained in:
Jeremy Dormitzer 2020-02-11 17:13:57 -05:00
parent 442bad66a4
commit cd350a4a35

View File

@ -2133,7 +2133,14 @@ A handy utility that reverse the current frame window split (vertical to horizon
* EShell * EShell
Easy keybinding to open EShell: Easy keybinding to open EShell:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(leader-def-key "'" 'eshell) (defun open-eshell (&optional arg)
(interactive "P")
(if (and (fboundp 'projectile-project-root)
(projectile-project-root))
(projectile-run-eshell arg)
(eshell arg)))
(leader-def-key "'" 'open-eshell)
#+END_SRC #+END_SRC
Make EShell's tab completion work like Bash's: Make EShell's tab completion work like Bash's:
@ -2322,7 +2329,6 @@ Manage node version via NVM within Emacs:
(nvm-use version))) (nvm-use version)))
#+END_SRC #+END_SRC
* Typescript * Typescript
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package typescript-mode (use-package typescript-mode
@ -4933,13 +4939,20 @@ A better terminal emulator for Emacs. Replaces ansi-term, not EShell.
(apply #'eshell-exec-in-vterm args))) (apply #'eshell-exec-in-vterm args)))
:commands (vterm vterm-other-window vterm-mode)) :commands (vterm vterm-other-window vterm-mode))
(defun open-vterm (&optional new-buffer) (defun run-vterm (&optional new-buffer)
(interactive "P") (interactive "P")
(let ((buffer-name (when (not new-buffer) "vterm"))) (let ((buffer-name (when (not new-buffer) "vterm")))
(if (and buffer-name (get-buffer buffer-name)) (if (and buffer-name (get-buffer buffer-name))
(switch-to-buffer buffer-name) (switch-to-buffer buffer-name)
(vterm buffer-name)))) (vterm buffer-name))))
(defun open-vterm (&optional arg)
(interactive "P")
(if (and (fboundp 'projectile-project-root)
(projectile-project-root))
(projectile-run-vterm arg)
(run-vterm arg)))
(leader-def-key "sv" 'open-vterm) (leader-def-key "sv" 'open-vterm)
#+END_SRC #+END_SRC