There are several ways of running a shell inside Emacs. I don’t find that I need to use it very often as I do so much within Emacs these days, but when I do it’s handy to quickly bring up the shell, run a command the then dismiss it again. The shell-pop package does this very smartly. One key combo (I use C-t
) pops up a shell window for the directory containing the file you are currently editing, and then C-t
dismisses the shell window when you are done.
The github page has lots of details on how to configure it, and I use a fairly minimal setup and use the ansi-term
terminal emulator and zsh
as my shell. Here is my configuration:
(use-package shell-pop :bind (("C-t" . shell-pop)) :config (setq shell-pop-shell-type (quote ("ansi-term" "*ansi-term*" (lambda nil (ansi-term shell-pop-term-shell))))) (setq shell-pop-term-shell "/bin/zsh") ;; need to do this manually or not picked up by `shell-pop' (shell-pop--set-shell-type 'shell-pop-shell-type shell-pop-shell-type))
The last line is needed but I can’t remember where I got it from!