Reputation: 96274
I would like to associate a keyboard binding in Emacs (e.g. C-c a) that automatically starts an ansi-term window with a shell that I have pre-specified in my .emacs
file (without prompting anything)
For reference, there are two threads in StackOverflow that address similar problems:
but it isn't obvious to me how to combine the ideas in those threads to get an answer to my question.
Upvotes: 3
Views: 904
Reputation: 5020
I suggest you to use multi-term. As its name implies, it lets you deal with multiple term using ansi-term.
Here is a small configuration:
(require 'multi-term)
(eval-after-load "multi-term"
'(setq multi-term-program "/bin/bash"
term-unbind-key-list '("C-x"
"C-h"
"M-x"
"C-z")
term-term-name "xterm-256color"))
(global-set-key (kbd "C-c a") 'multi-term-next)
My whole configuration for multi-term is
here
(compilation-shell-minor-mode
is really nice).
Upvotes: 1
Reputation: 9262
(global-set-key (kbd "C-c a") '(lambda () (interactive) (ansi-term "/bin/zsh")))
Upvotes: 7