about summary refs log tree commit diff
path: root/init-modes.el
blob: 55b25358bfc220cc5cbbea3fba2224e1d05232e2 (plain) (blame)
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
(mapc 'require '(projectile hi2 ac-nrepl yasnippet))
;; Initializes modes I use.

(add-hook 'prog-mode-hook 'esk-add-watchwords)
(add-hook 'prog-mode-hook 'idle-highlight-mode)

;; Configure 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 '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))

;; Use auto-complete as completion at point
(defun set-auto-complete-as-completion-at-point-function ()
  (setq completion-at-point-functions '(auto-complete)))

(add-hook 'auto-complete-mode-hook
          'set-auto-complete-as-completion-at-point-function)


;; Configure nrepl (Clojure REPL) and clojure-mode

(defun nrepl-mode-setup ()
  "Activates paredit, rainbow delimiters and ac-nrepl"
  (ac-nrepl-setup)
  (rainbow-delimiters-mode 1)
  (paredit-mode 1))

;; Use ac-nrepl for completion
(add-hook 'nrepl-mode-hook 'nrepl-mode-setup)
(add-hook 'nrepl-interaction-mode-hook 'nrepl-mode-setup)

;; I want history up/down without modifiers
(define-key nrepl-repl-mode-map (kbd "<up>") 'nrepl-backward-input)
(define-key nrepl-repl-mode-map (kbd "<down>") 'nrepl-forward-input)
(define-key nrepl-repl-mode-map (kbd "C-<up>") 'previous-line)
(define-key nrepl-repl-mode-map (kbd "C-<down>") 'next-line)
(define-key nrepl-repl-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc)

(define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc)
(define-key nrepl-interaction-mode-map (kbd "C-c D") 'nrepl-doc)


(eval-after-load "auto-complete"
   '(add-to-list 'ac-modes 'nrepl-mode))

;; Paredit in clojure
(add-hook 'clojure-mode-hook 'paredit-mode)

;; eldoc in clojure
(add-hook 'nrepl-interaction-mode-hook
          'nrepl-turn-on-eldoc-mode)

(add-hook 'nrepl-interaction-mode-hook
          'paredit-mode)

;; Don't annoy me
(setq nrepl-hide-special-buffers t)
(setq nrepl-popup-stacktraces nil)

;; Enable projectile for all things programming
(add-hook 'prog-mode-hook 'projectile-on)

;; Enable rainbow-delimiters for all things programming
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)

;; Enable Paredit in Emacs Lisp mode
(add-hook 'emacs-lisp-mode-hook 'paredit-mode)

;; Always highlight matching brackets
(show-paren-mode 1)

;; Represent undo-history as an actual tree (visualize with C-x u)
(setq undo-tree-mode-lighter "")
(require 'undo-tree)
(global-undo-tree-mode)

;; Keep track of recent files
(recentf-mode)

;; Enable Nyan mode
(nyan-mode 1)

;; Easily navigate sillycased words
(global-subword-mode 1)

;; Transparently open compressed files
(auto-compression-mode t)

(provide 'init-modes)