-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
142 lines (121 loc) · 4.73 KB
/
init.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
;;;;;;;;;;;;;;;;; not create tempolary file ;;;;;;;;;;
(setq backup-inhibited t)
(setq delete-auto-save-files t)
(setq auto-save-default nil)
(setq auto-save-list-file-name nil)
(setq auto-save-list-file-prefix nil)
(setq make-backup-files nil)
;;;;;;;;;;;;;;;;; load path ;;;;;;;;;;;;;;;;;;;;;;;;;
(defun add-to-load-path (&rest paths)
(let (path)
(dolist (path paths paths)
(let ((default-directory (expand-file-name (concat user-emacs-directory path))))
(add-to-list 'load-path default-directory)
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(normal-top-level-add-subdirs-to-load-path))))))
;;;;;;;;;;;;;;;;;;;keybind;;;;;;;;;;;;;;;;;;;;
(global-set-key "\C-h" 'delete-backward-char)
(defface hlline-face
'((((class color)
(background dark))
(:background "gray20"))
(((class color)
(background light))
(:background "ForestGreen"))
(t
()))
"*Face used by hl-line.")
;;(setq hl-line-face 'hlline-face)
(setq hl-line-face 'underline) ; 下線
(global-hl-line-mode)
;;;;;;;;;;;;;;;;;;;;Package;;;;;;;;;;;;;;;;;;;;
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(setup-flycheck-d-unittest)
;; elpa
(add-to-load-path "elpa")
;; Emacs directory
(when load-file-name
(setq user-emacs-directory (file-name-directory load-file-name)))
(defun package-install-with-refresh (package)
(unless (assq package package-alist)
(package-refresh-contents))
(unless (package-installed-p package)
(package-install package)))
;;;;;;;;;;;;;;;;;;;;Auto-Complete;;;;;;;;;;;;;;;;;;;;
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete-1.4/dict")
;; C++ style
(add-hook 'c++-mode-hook
'(lambda ()
(define-key c-mode-base-map "\C-m" 'newline-and-indent)
(c-set-style "stroustrup")
(setq indent-tabs-mode nil)
))
(put 'upcase-region 'disabled nil)
(add-to-list 'exec-path (expand-file-name "/usr/bin/dmd"))
;; D Programming Language Style
(add-hook 'd-mode-hook
(lambda ()
;;(c-toggle-auto-hungry-state 1)
(define-key c-mode-base-map "\C-m" 'newline-and-indent)
(c-set-style "python")
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)
(local-set-key (kbd "C-c C-p") 'flycheck-previous-error)
(local-set-key (kbd "C-c C-n") 'flycheck-next-error)))
;;TEX設定
;;YaTeX の設定適用
(setq auto-mode-alist
(cons (cons "\.tex$" 'yatex-mode) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
;; YaTeX のパスを通す(app 名は適宜変更)
(add-to-list 'load-path "/Applications/Emacs.app/Contents/Resources/site-lisp/yatex")
(setq YaTeX-dvipdf-command "/usr/texbin/dvipdfmx ")
(setq tex-command "platex ")
;; (setq dvi2-command "dvipdfmx ")
(setq dvi2-command "/usr/bin/open -a Preview ")
(setq tex-pdfview-command "/usr/bin/open -a Preview ")
;; (setq tex-pdfview-command "/usr/bin/open -a Adobe\ Acrobat\ Reader\ DC")
;; (setq tex-pdfview-command "/usr/bin/open -a \"Adobe Acrobat Reader DC\" `echo %s | gsed -e \"s/\\.[^.]*$/\\.pdf/\"`")
;; Haskell Mode ;;;;;;
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(add-hook 'haskell-mode-hook 'font-lock-mode)
(add-hook 'haskell-mode-hook 'imenu-add-menubar-index)
;; Processing Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq processing-location "/usr/bin/processing-java")
(setq processing-application-dir "/Applications/Processing.app")
(setq processing-sketch-dir "~/Documents/Processing")
;; markdown-mode
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(setq markdown-command "/opt/local/bin/multimarkdown")
;; SSH
(require 'tramp)
(setq tramp-default-method "ssh")
;; Install evil
(package-install-with-refresh 'evil)
;; Enable evil
(require 'evil)
(evil-mode 0)
;; Show Git branch information to mode-line
(let ((cell (or (memq 'mode-line-position mode-line-format)
(memq 'mode-line-buffer-identification mode-line-format)))
(newcdr '(:eval (my/update-git-branch-mode-line))))
(unless (member newcdr mode-line-format)
(setcdr cell (cons newcdr (cdr cell)))))
(defun my/update-git-branch-mode-line ()
(let* ((branch (replace-regexp-in-string
"[\r\n]+\\'" ""
(shell-command-to-string "git symbolic-ref -q HEAD")))
(mode-line-str (if (string-match "^refs/heads/" branch)
(format "[%s]" (substring branch 11))
"[Not Repo]")))
(propertize mode-line-str
'face '((:foreground "Dark green" :weight bold)))))