console apps in emacs with multi-term



multi-term






updated Whenever it makes sense, I try to use emacs for my computer-based activities;
surely, programs like The Gimp or a graphical web browser cannot yet be
replace by emacs, but I'm making progress. I like the ways emacs gives me to
automate and speed-up my tasks; I get some return-on-time-investment.



2010 or not, I still spend quite a bit of time on the console. So why not do
that from within emacs? There different ways to run shells within emacs.



The simplest one is shell (i.e,, M-x shell), which starts a simple shell,
which does not support which does not support 'graphical' console applications,
such as mutt, mc, htop.



Then there are term and ansi-term (M-x ansi-term) that do support such
applications, which ansi-term supporting colors as well (it seems to have
become the default for term in recent emacs versions).



Another one is the nifty EShell (included with emacs), which is not just a
(simple) terminal, but also a full shell environment, and has integration with
other things in emacs. It's nice, but has some of the limitations that shell
has - you cannot run 'graphical' applications; also, I don't really need a
shell, as I am quite happy with zsh (zed shell) already, which is more
powerful, and I prefer a shell that works both inside and outside emacs.



For all these reasons, I am using MultiTerm, which has 'graphical' support that
ansi-term has, but adds a nice extra, namely support for multiple terminals
within emacs. I'm not fully up to date with the exact difference in the terminal
support between the two, but I haven't had any problems so far.



You can install multi-term (put it in your load-path), and add the
following to your .emacs:





(autoload 'multi-term "multi-term" nil t)
(autoload 'multi-term-next "multi-term" nil t)

(setq multi-term-program "/bin/bash") ;; use bash
;; (setq multi-term-program "/bin/zsh") ;; or use zsh...

;; only needed if you use autopair
(add-hook 'term-mode-hook
#'(lambda () (setq autopair-dont-activate t)))


(global-set-key (kbd "C-c t") 'multi-term-next)
(global-set-key (kbd "C-c T") 'multi-term) ;; create a new one





With this, C-c t will jump through your multi-term buffers (create a new one
if it doesn not exist yet), while C-c T unconditionally creates a new
terminal.


No comments:

Post a Comment

Followers

Popular Posts