summaryrefslogtreecommitdiff
path: root/emacs/.emacs
blob: 3e619261b71baaff398367f5356317e46beb2625 (plain)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
(require 'package)
(setq package-enable-at-startup nil)

(add-to-list 'load-path "~/.emacs.d/load")
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives
	     '("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

(package-initialize )

(eval-when-compile
  (require 'use-package))

(use-package auto-package-update
  :ensure t
  :config
  (setq auto-package-update-delete-old-versions t))

;;
;; Evil mode
;;
(defun save-and-quit ()
  "Save the document and exit buffer"
  (interactive)
  (save-buffer (current-buffer))
  (kill-this-buffer))

					; TODO find out what this is
(setq evil-want-integration nil)
(setq evil-want-keybinding nil)

(use-package evil
  :ensure t
  :init
  (setq evil-want-C-u-scroll t)
  :config
  (evil-ex-define-cmd "b[utterfly]" 'bufferfly)
  (evil-ex-define-cmd "q[uit]" 'kill-this-buffer)
  (evil-ex-define-cmd "wq" 'save-and-quit)
  (evil-ex-define-cmd "describe-function" 'describe-function)
  (evil-mode 1))

(use-package evil-collection
			 :config
			 (evil-collection-init))

(use-package org-evil
  :ensure t
  )

(use-package evil-surround
  :ensure t
  :config
  (global-evil-surround-mode 1))

(use-package nlinum-relative
  :ensure
  :config
  ;; something else you want
  (nlinum-relative-setup-evil)
  (add-hook 'prog-mode-hook 'nlinum-relative-mode))

(use-package evil-magit
  :ensure t)

;;
;; General config
;;
(use-package calfw
  :ensure t)
(use-package calfw-ical
  :ensure t)
(use-package calfw-org
  :ensure t)

(defun open-calendar ()
  (interactive)
  (cfw:open-calendar-buffer :contents-sources
			    (list
			     (cfw:org-create-source "Green")
			     )
			    )
  )

(setq backup-directory-alist `(("." . "~/.saves")))

(setq initial-buffer-choice nil)
(setq org-support-shift-select t)

(setq c-default-style "k&r"
      c-basic-offset 4)


(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode))


(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)                 ; optional

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(company-c-headers-path-user
   (quote
    ("." "~/Documents/aausat6/software/lib/libcsp/include" "~/Documents/aausat6/software/stm32f/libopencm3/include" "~/Documents/aausat6/software/lib/libfreertosv10/Source/include")))
 '(custom-enabled-themes (quote (tango-dark)))
 '(package-selected-packages
   (quote
    (company-ycmd ycmd company-c-headers evil-magit magit company auto-complete-config auto-complete evil-collection evil use-package))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(defun show-file-name ()
  "Show the current filename"
  (interactive)
  (message (buffer-file-name)) )

(defun goto-startup-screen ()
  "Show the startup screen"
  (interactive)
  (display-startup-screen) )

(setq org-directory "~/Syncthing/OrgNotes")
(setq org-default-notes-file (concat org-directory "/notes.org"))

(use-package magit
  :ensure t )


;;
;; Auto-complete (AC)
;;
(use-package auto-complete
  :ensure t
  :config
  (ac-config-default)
)
(require 'auto-complete-config)

(use-package company-c-headers
  :ensure t
  )
(use-package company
  :ensure t)

(add-hook 'global-init-hook 'global-company-mode)

(add-to-list 'company-backends 'company-c-headers)

;;
;; Keybindings
;;

;; Leader Keybinding
(defvar leader-map (make-sparse-keymap)
  "Keymap for evil leader key")

(define-key evil-normal-state-map (kbd "SPC") leader-map)

(define-key leader-map "b" 'switch-to-buffer)
(define-key leader-map "t" 'term)
(define-key leader-map "o" 'org-capture)