-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-linux-server.el
60 lines (52 loc) · 1.63 KB
/
init-linux-server.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
(eval-when-compile (require 'use-package))
(setf (cdr (assoc "melpa" package-archives))
"http://melpa.org/packages/"
(cdr (assoc "melpa-stable" package-archives))
"http://stable.melpa.org/packages/")
;; add ruby-mode
(use-package ruby-mode
:mode (("\\.rbw?\\'" . ruby-mode)
("Gemfile\\'" . ruby-mode)
("Rakefile\\'" . ruby-mode))
:interpreter "ruby"
:commands ruby-mode
:no-require t)
;; for ideas2
(add-hook 'after-init-hook
(lambda ()
(when (string= (user-real-login-name) "ideas2")
(setq backup-directory-alist
'((".*" . "/aptmp/ideas2/aramaki/.emacs_backup"))))))
(use-package term
:defer t
:config
(bind-key "C-c C-j" 'term-toggle-mode term-mode-map)
(bind-key "C-c C-j" 'term-toggle-mode term-raw-map))
(defun ansi-term-in-right-window ()
"Open `ansi-term' in new window."
(interactive)
(split-window-sensibly)
(other-window 1)
(ansi-term "/bin/bash")
(other-window -1))
(defun goto-or-open-term-window ()
"Go to term window."
(interactive)
(let* ((bufname "*ansi-term*")
(buffer (get-buffer bufname))
(window (get-buffer-window bufname)))
(if window
(select-window window)
(if buffer
(switch-to-buffer-other-window buffer)
(progn (ansi-term-in-right-window)
(other-window 1))))))
(bind-key "C-c t" 'goto-or-open-term-window)
(defun term-toggle-mode ()
"Toggle term between line mode and char mode."
(interactive)
(if (term-in-char-mode)
(term-line-mode)
(term-char-mode)))
(add-hook 'term-mode-hook
(lambda () (linum-mode -1)))