summary refs log tree commit diff stats
path: root/init.el
blob: 11e487c051798a6f152610d4b3d8ec8bde529e11 (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
;;; init.el -*- lexical-binding: t; coding: utf-8; -*-

;;; Commentary:
;; BANKRUPT_SCORE: 1
;; ^ the number of times I've declared Emacs bankruptcy.
;; Does this mean I'm part of the cool kids now?

;;; Macros
(defmacro cuss (var val)
    "Basically `use-package' `:custom' but without either."
  `(progn
    (funcall (or (get ',var 'custom-set) #'set-default)
	     ',var ,val)))

;;; Files
;; keep `emacs-user-directory' tidy
(use-package no-littering)

;; don't clutter `init.el' with customize crap
(cuss custom-file (no-littering-expand-etc-file-name "custom.el"))

;; backups
(cuss backup-directory-alist
      `((".*" . ,(no-littering-expand-var-file-name "backup/"))))

;; recent files
(use-package recentf
  :config
  (add-to-list 'recentf-exclude no-littering-var-directory)
  (add-to-list 'recentf-exclude no-littering-etc-directory)
  :custom
  (recentf-max-menu-items 100)
  (recentf-max-saved-items 100)
  :config
  (recentf-mode +1))

;;; Save/Restore
;; save places in files
(use-package saveplace
  :custom
  (save-place-file (no-littering-expand-var-file-name "places"))
  :config
  (save-place-mode +1))

;; save history of variables
(use-package savehist
  :custom
  (savehist-additional-variables
   '(kill-ring
     search-ring
     regexp-search-ring))
  :config
  (savehist-mode +1))

;;; Buffers
;; uniquely name buffers
(cuss uniquify-buffer-name-style 'forward)

;;; UI
;; frame defaults
(cuss default-frame-alist '((tool-bar-lines . 0)
			    (menu-bar-lines . 0)
			    (vertical-scroll-bars . nil)
			    (horizontal-scroll-bars . nil)
			    (right-divider-width . 2)
			    (bottom-divider-width . 2)
			    (left-fringe-width . 2)
			    (right-fringe-width . 2)))

;; cursor
(cuss cursor-type 'bar)
(cuss cursor-in-non-selected-windows 'hollow)
(blink-cursor-mode 0)

;; mouse
(cuss mouse-yank-at-point t) ; yank at the point instead of where clicked

;; startup screen
(cuss inhibit-startup-buffer-menu t)
(cuss inhibit-startup-screen t)
(cuss initial-buffer-choice t) ; start in *scratch*
(cuss initial-scratch-message nil)

;; interactivity
(fset 'yes-or-no-p #'y-or-n-p)

;; themes
(use-package modus-operandi-theme
  :config
  (load-theme 'modus-operandi t))

(use-package modus-vivendi-theme)

;; fonts
(set-face-attribute 'default nil
		    :family "DejaVu Sans Mono"
		    :height 110)

(set-face-attribute 'fixed-pitch nil
		    :family "DejaVu Sans Mono"
		    :height 110)

(set-face-attribute 'variable-pitch nil
		    :family "DejaVu Serif"
		    :height 120)

;;; Text editing
;; visual line mode
(global-visual-line-mode +1)

;; delete the selection when typing
(delete-selection-mode +1)

;; clipboard
(cuss save-interprogram-paste-before-kill t) ; save existing clipboard text to kill ring before replacing it

;;; Programming
;; Git
(use-package magit
  :bind
  ("C-x g" . magit-status)
  :config
  (add-to-list 'magit-no-confirm 'stage-all-changes))

(when (executable-find "cmake")
  (use-package libgit)
  (use-package magit-libgit))