-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
135 lines (106 loc) · 4.03 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
;;; init.el --- My Emacs configuration -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2020 Brad Ison
;;
;; Author: Brad Ison <[email protected]>
;; URL: http://github.com/bison/emacs.d
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;; Code:
(setq user-full-name "Brad Ison")
(setq user-mail-address "[email protected]")
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
(require 'ring)
(require 'server)
(require 'ispell)
(require 'recentf)
(require 'bison-util)
(require 'bison-straight.el)
;; Create the cache directory.
(bison/mkdir bison/emacs-cache-dir #o700)
;; Backup and auto-save settings.
(let ((backups-dir (bison/expand-cache-file "backups/"))
(auto-saves-dir (bison/expand-cache-file "auto-saves/")))
(bison/mkdir auto-saves-dir #o700)
(bison/mkdir backups-dir #o700)
(setq auto-save-file-name-transforms `((".*" ,auto-saves-dir t))
auto-save-list-file-prefix auto-saves-dir
auto-save-visited-mode t)
(setq backup-directory-alist `(("." . ,backups-dir))
backup-by-copying t
delete-old-versions t
version-control t
kept-new-versions 6
kept-old-versions 3))
;; Location for the emacs server socket.
(setq server-socket-dir bison/emacs-cache-dir)
(setq server-name (bison/expand-cache-file "server"))
;; Basic settings.
(setq-default inhibit-startup-screen t)
(setq-default truncate-lines t)
(setq-default require-final-newline t)
(setq-default show-trailing-whitespace t)
(setq-default linum-format " %3d ")
(setq-default tab-width 4)
(size-indication-mode t)
(column-number-mode t)
(line-number-mode t)
;; Set macOS titlebar appearance.
(when (eq system-type 'darwin)
(setq ns-use-proxy-icon nil)
(set-fringe-mode 0)
(add-to-list 'default-frame-alist '(internal-border-width . 0))
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist '(ns-appearance . dark)))
;; Set the default font.
(cond ((eq system-type 'darwin)
(set-face-attribute
'default nil
:family "Roboto Mono" :height 160))
((eq system-type 'gnu/linux)
(set-face-attribute
'default nil
:family "Source Code Pro" :height 140)))
;; Window hopping shortcuts.
(global-set-key (kbd "M-o") (lambda () (interactive) (other-window 1)))
(global-set-key (kbd "M-O") (lambda () (interactive) (other-window -1)))
(global-set-key (kbd "C-x O") (lambda () (interactive) (other-window -1)))
;; Disable scroll bar, tool bar, and menu bar.
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
;; Bootstrap straight.el package manager.
(bison/bootstrap-straight.el)
;; Install and/or initialize all packages.
(bison/load-directory (expand-file-name "init.d" user-emacs-directory))
;; Speed up tramp buffers.
(setq vc-ignore-dir-regexp
(format "\\(%s\\)\\|\\(%s\\)"
vc-ignore-dir-regexp
tramp-file-name-regexp))
;; Load customizations.
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(if (file-exists-p custom-file) (load custom-file))
;; Save recently opened files list to the cache directory.
(setq recentf-save-file (bison/expand-cache-file "recentf"))
;; Quick cycle through ispell dictionaries.
(let* ((dicts '("en_US" "de_DE"))
(bison/dict-ring (make-ring (length dicts))))
(when (eq system-type 'darwin)
(setenv "DICPATH" (concat (getenv "HOME") "/Library/Spelling"))
(setenv "DICTIONARY" "en_US"))
(setq ispell-program-name "hunspell")
(setq ispell-dictionary (car dicts))
(dolist (elem dicts) (ring-insert bison/dict-ring elem))
(defun bison/cycle-ispell-languages ()
(interactive)
(let ((dict (ring-ref bison/dict-ring -1)))
(ring-insert bison/dict-ring dict)
(ispell-change-dictionary dict)))
(global-set-key [f9] 'bison/cycle-ispell-languages))
;; Enable flyspell for source code comments.
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
;;; init.el ends here