summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/bd--essentials.el
blob: 483fd25b4ff3480144c6171518cffca2b01ef948 (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
;; -*- lexical-binding: t; -*-


;;;; standard bindings
(keymap-global-unset "C-z")
(keymap-global-unset "C-x C-z")
;; the binding to quit emacs
(keymap-global-unset "C-x C-c")

(global-set-key (kbd "C-z =") 'text-scale-increase)
(global-set-key (kbd "C-z -") 'text-scale-decrease)


;;;; UI
(setopt inhibit-startup-message t)


;;;; defaults
;; basic editing
(setopt kill-whole-line t
        sentence-end-double-space nil)
(global-hl-line-mode 1)
(global-visual-line-mode t)

(defun bd/cleanup-exempt-modes ()
  "Modes which should NOT be autoformatted
on save."
  (unless (or (derived-mode-p 'text-mode) (equal major-mode 'makefile-gmake-mode))
    (bd/cleanup-buffer)))

(defun bd/cleanup-buffer ()
  (interactive)
  (delete-trailing-whitespace)
  (untabify (point-min) (point-max))
  (indent-region (point-min) (point-max)))

(setopt next-line-add-newlines t)
(add-hook 'before-save-hook 'bd/cleanup-exempt-modes)


;;;; buffers
(global-auto-revert-mode 1)
(setopt global-auto-revert-non-file-buffers t)
(winner-mode 1)
(setopt scroll-up-aggressively '0.65
        scroll-down-aggressively '0.65)


(provide 'bd--essentials)