]> git.rkrishnan.org Git - .emacs.d.git/blob - init.el
intero instead of ghc-mod
[.emacs.d.git] / init.el
1 (package-initialize)
2 (show-paren-mode 1)
3 ;; y-or-n instead of yes-or-no
4 (defalias 'yes-or-no-p 'y-or-n-p)
5
6 ;; Don't show startup msg, don't store tilde files
7 (setq make-backup-files nil)
8 (setq initial-scratch-message "")
9 (setq inhibit-startup-message t)
10
11 ;; turn OFF syntax highlighting
12 (global-font-lock-mode 0)
13
14 ;; cursor bar
15 (setq-default cursor-type '(bar . 2))
16
17 ;; column number
18 (column-number-mode 1)
19
20 ;; font
21 ;; (set-default-font "Inconsolata-12")
22 (set-default-font "InconsolataGo-12")
23
24 ;; Don't let Emacs hurt your ears
25 (setq visible-bell t)
26
27 ;; This is bound to f11 in Emacs 24.4
28 ;; (toggle-frame-fullscreen)
29 (custom-set-variables
30  ;; custom-set-variables was added by Custom.
31  ;; If you edit it by hand, you could mess it up, so be careful.
32  ;; Your init file should contain only one such instance.
33  ;; If there is more than one, they won't work right.
34  '(initial-frame-alist (quote ((fullscreen . maximized))))
35  '(send-mail-function (quote smtpmail-send-it)))
36
37 ;; Who use the bar to scroll?
38 (when (display-graphic-p)
39   (progn
40     (scroll-bar-mode 0)
41
42     (tool-bar-mode 0)
43     (menu-bar-mode 0)))
44
45 ;; tangotango
46 ;; (load-theme 'tangotango t)
47 ;; (load-theme 'railscasts t)
48 ;; (load-theme 'leuven t)
49
50 ;; erc
51 (require 'erc)
52 (require 'tls)
53 ;; (setq tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof"))
54
55 (erc-autojoin-mode t)
56 (setq erc-autojoin-channels-alist
57       '((".*\\.freenode.net" "#tahoe-lafs")
58         (".*\\.oftc.net" "#LeastAuthority")
59         ;; (".*\\.mozilla.org" "#rust-beginners")
60         ))
61
62 ;; check channels
63 (erc-track-mode t)
64 (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
65                                  "324" "329" "332" "333" "353" "477"))
66 ;; don't show any of this
67 (setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK"))
68
69 (defun start-erc ()
70   "Connect to IRC."
71   (interactive)
72   (when (y-or-n-p "Do you want to start IRC? ")
73     ;; (erc-tls :server "irc.mozilla.org" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")
74     (erc-tls :server "irc.freenode.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")
75     (erc-tls :server "irc.oftc.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")))
76
77 ;; switch to ERC with Ctrl+c e
78 (global-set-key (kbd "C-c e") 'start-erc) ;; ERC
79
80 ;; Haskell intero mode
81 (add-hook 'haskell-mode-hook 'intero-mode)
82
83 ;; ido
84 (setq ido-enable-flex-matching t)
85 (setq ido-everywhere t)
86 (ido-mode 1)
87
88 ;; disable tabs for indentation
89 (setq-default indent-tabs-mode nil)
90
91 ;; (require 'whitespace)
92 ;; (setq whitespace-style '(face lines-tail))
93 ;; (setq whitespace-line-column 80)
94 ;; (global-whitespace-mode t)
95
96 ;; ;; show trailing whitespaces
97 ;; (setq-default show-trailing-whitespace t)
98 ;; (setq-default indicate-empty-lines t)
99
100 ;; C style
101 (setq c-default-style "k&r"
102       c-basic-offset 4)
103
104 ;; hlint
105 (add-to-list 'load-path "~/.emacs.d/hs-lint")
106 (require 'hs-lint)
107 (defun my-haskell-mode-hook ()
108    (local-set-key "\C-cl" 'hs-lint))
109
110 (add-hook 'haskell-mode-hook 'my-haskell-mode-hook)
111
112 ;; gofmt
113 (add-hook 'before-save-hook #'gofmt-before-save)
114 (add-hook 'go-mode-hook (lambda ()
115                           (local-set-key (kbd "C-c C-r")
116                                          'go-remove-unused-imports)))
117 (add-hook 'go-mode-hook (lambda ()
118                           (local-set-key (kbd "C-c i")
119                                          'go-goto-imports)))
120
121 ;; asp
122 (add-to-list 'load-path "~/.emacs.d/asp-mode")
123 (autoload 'asp-mode "asp-mode")
124 (setq auto-mode-alist
125       (cons '("\\.asp\\'" . asp-mode) auto-mode-alist))
126
127 ;; line-number-mode
128 (global-linum-mode t)
129 (global-hl-line-mode 0)
130
131 ;; fci -- fill-column-indicator
132 (setq fci-rule-column 81)
133 (setq fci-rule-width 1)
134 (setq fci-rule-color "darkblue")
135
136 ;; turn off electric-indent-mode
137 (when (fboundp 'electric-indent-mode) (electric-indent-mode -1))
138
139 ;; notmuch
140 (setq mail-user-agent 'message-user-agent)
141 (setq user-mail-address "ram@rkrishnan.org"
142       user-full-name "Ramakrishnan Muthukrishnan")
143
144 ;; smtp
145 (setq smtpmail-stream-type 'ssl
146       smtpmail-smtp-server "mail.messagingengine.com"
147       smtpmail-smtp-service 465)
148
149 ;; addressbook
150 (require 'notmuch-address)
151 (setq notmuch-address-command "/usr/bin/notmuch-addrlookup")
152 ;;(notmuch-address-message-insinuate)
153
154 (require 'smtpmail)
155 (setq message-send-mail-function 'smtpmail-send-it)
156 (require 'starttls)
157
158 ;; sign all emails
159 (add-hook 'message-setup-hook 'mml-secure-message-sign-pgp)
160
161 (custom-set-faces
162  ;; custom-set-faces was added by Custom.
163  ;; If you edit it by hand, you could mess it up, so be careful.
164  ;; Your init file should contain only one such instance.
165  ;; If there is more than one, they won't work right.
166  )
167
168 ;; company mode for auto completion
169 (add-hook 'after-init-hook 'global-company-mode)
170
171 ;; Reduce the time after which the company auto completion popup opens
172 (setq company-idle-delay 0.2)
173
174 ;; Reduce the number of characters before company kicks in
175 (setq company-minimum-prefix-length 1)
176
177 ;; Set path to racer binary
178 (setq racer-cmd "/home/ram/.cargo/bin/racer")
179
180 (add-hook 'rust-mode-hook
181           '(lambda ()
182              (racer-activate)
183              (racer-turn-on-eldoc)
184              (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
185              (set (make-local-variable 'company-backends) '(company-racer))
186              (local-set-key (kbd "M-.") #'racer-find-definition)
187              (local-set-key (kbd "TAB") #'racer-complete-or-indent)))
188
189 ;; highlight todo
190 ;; (add-hook 'prog-mode-hook 'highlight-todos)
191
192 ;; Ledger
193 (setq ledger-binary-path "~/.cabal/bin/hledger")
194
195 ;; golang
196 (setq exec-path (cons "/usr/local/go/bin" exec-path))
197 (add-to-list 'exec-path (concat (getenv "GOPATH") "/bin"))
198
199 (defun go-mode-setup ()
200   (go-eldoc-setup)
201   (setq gofmt-command "goimports")
202   (add-hook 'before-save-hook 'gofmt-before-save))
203
204 (add-hook 'go-mode-hook 'go-mode-setup)
205
206 ;; alias man to w.o.man
207 (defalias 'man 'woman)
208
209 ;; eshell aliases
210 (defun eshell/emacs (&rest args)
211   "open a file in emacs"
212   (if (null args)
213       (bury-buffer)
214     (mapc #'find-file (mapcar #'expand-file-name (eshell-flatten-list (reverse args))))))
215
216 ;(desktop-save-mode 1)
217
218 ;; which function?
219 (which-func-mode 1)
220 (add-to-list 'which-func-modes '(c-mode c++-mode rust-mode haskell-mode))
221
222 ;; flysheck
223 (add-hook 'after-init-hook #'global-flycheck-mode)
224
225