-
Notifications
You must be signed in to change notification settings - Fork 0
/
multi-term.el
124 lines (110 loc) · 3.88 KB
/
multi-term.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
(require 'multi-term)
(setq multi-term-program "zsh")
(defun term-send-escape ()
(interactive)
(term-send-raw-string "\e"))
(defun reset-term-colors ()
(interactive)
(set-foreground-color (face-foreground 'default))
(set-background-color (face-background 'default))
(custom-set-variables
'(term-default-bg-color (face-background 'default))
'(term-default-fg-color (face-foreground 'default))))
;; Limit the buffer for shells.
(add-hook 'comint-output-filter-functions 'comint-truncate-buffer)
(setq comint-buffer-maximum-size 10000)
(when window-system
(reset-term-colors)
(custom-set-variables
'(term-bind-key-alist '(("C-c C-c" . term-interrupt-subjob)
("C-p" . previous-line)
("C-s" . isearch-forward)
("C-r" . isearch-backward)
("C-m" . term-send-raw)
("M-f" . term-send-forward-word)
("M-b" . term-send-backward-word)
("M-o" . term-send-backspace)
("M-p" . term-send-up)
("M-n" . term-send-down)
("M-M" . term-send-forward-kill-word)
("M-N" . term-send-backward-kill-word)
("M-r" . term-send-reverse-search-history)
("M-," . term-send-input)
("M-." . comint-dynamic-complete)
;; These were defined in term but undefined by
;; multi-term. I want them back.
("C-c C-j" . term-line-mode)
("C-c C-k" . term-char-mode)
("C-c C-e" . term-send-escape)))))
(defun bash ()
(interactive)
(let ((multi-term-program "bash")
(multi-term-buffer-name "bash"))
(multi-term)))
(global-set-key (kbd "<f6> b") 'bash)
(defun python ()
(interactive)
(let ((multi-term-program "python")
(multi-term-buffer-name "python"))
(multi-term)))
;;; Normally you should just use SLIME.
(defun sbcl ()
(interactive)
(let ((multi-term-program "sbcl")
(multi-term-buffer-name "sbcl"))
(multi-term)))
(defun psql ()
(interactive)
(let ((multi-term-program "psql")
(multi-term-buffer-name "psql"))
(multi-term)))
(defun tig ()
(interactive)
(let ((multi-term-program "tig")
(multi-term-program-switches "-a")
(multi-term-buffer-name "tig"))
(multi-term)))
(defun terraform-console ()
(interactive)
(let ((multi-term-program "terraform")
(multi-term-program-switches "console")
(multi-term-buffer-name "terraform console"))
(multi-term)))
(global-set-key (kbd "<f6> t") 'terraform-console)
(defun zsh ()
(interactive)
(let ((multi-term-program "zsh")
(multi-term-buffer-name "zsh"))
(multi-term)))
(defun zsh-named (buffer-name)
(interactive "sZ Shell buffer named: ")
(let ((multi-term-program "zsh")
(multi-term-buffer-name buffer-name))
(multi-term)))
(global-set-key (kbd "<f6> z") 'zsh)
(global-set-key (kbd "<f6> Z") 'zsh-named)
(defun su ()
(interactive)
(let ((multi-term-program "su")
(multi-term-buffer-name "su")
(multi-term-program-switches "--login"))
(multi-term)))
(global-set-key (kbd "<f6> r") 'su)
(defun ssh (ssh-to)
(interactive "sSSH to: ")
(let ((multi-term-program "ssh")
(multi-term-buffer-name ssh-to)
(multi-term-program-switches ssh-to))
(multi-term)))
(global-set-key (kbd "<f6> s") 'ssh)
(defun ri (query)
(interactive "sRI Query: ")
(let ((multi-term-program "ri")
(multi-term-buffer-name (concat "ri " query))
(multi-term-program-switches query))
(multi-term)))
(defun cljs-planck ()
(interactive)
(let ((multi-term-program "planck")
(multi-term-buffer-name "planck"))
(multi-term)))