about summary refs log tree commit diff
path: root/modules/workstation/emacs/init.el
blob: 507fb04b4a334e1795757e05d03de2c4f997d3f3 (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
;;; UI customization ;;;
(column-number-mode)
(electric-pair-mode)
(global-so-long-mode)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(show-paren-mode)
(tool-bar-mode -1)

(setq uniquify-buffer-name-style 'forward)
(setq-default truncate-lines t)

(load-theme 'monokai t)

;; <102 or >109 will make Ioveska look squished rather than tall,
;; narrow, and beautiful.
(set-face-attribute 'default nil :height 104)

;; Disabling bidirectional text will make Emacs less slow with very
;; long lines.
(setq bidi-paragraph-direction 'left-to-right)
(setq bidi-inhibit-bpa t)

;;; Major modes ;;;
(add-to-list 'auto-mode-alist '("\\.adoc\\'" . adoc-mode))
(add-to-list 'auto-mode-alist '("\\.quirks\\'" . conf-unix-mode))

;;; CC Mode ;;;
;; Default to kernel style.
(add-to-list 'c-default-style '(other . "linux"))

;;; Dired ;;;
(setq dired-listing-switches
      (combine-and-quote-strings '(dired-listing-switches "-h")))

;;; Direnv ;;;
(direnv-mode)
(global-set-key (kbd "C-c d") 'direnv-update-environment)

;;; Ibuffer ;;;
;; Open ibuffer in other window, to match behaviour of the default
;; list-buffers.
(global-set-key (kbd "C-x C-b") (lambda () (interactive) (ibuffer t)))

;;; ispell ;;;
;; System locale is Esperanto, but I write in English much more, and
;; spelling in Esperanto is easy anyway. ;)
(setq ispell-dictionary "english")

;;; Magit ;;;
(setq magit-delete-by-moving-to-trash delete-by-moving-to-trash)
(setq magit-repository-directories '(("/home/src" . 1)))
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x M-g") 'magit-dispatch)

(with-eval-after-load "magit"
  ;; Add a --no-gpg-sign option to Magit.  This is only useful with
  ;; commit.gpgsign=true.  It would be nice if commit.gpgsign=true just
  ;; meant that Magit showed the --gpg-sign option as enabled by
  ;; default, and disabling it would make Magit pass --no-gpg-sign to
  ;; git, but that's not currently the case, so we need a seperate
  ;; option for --no-gpg-sign.  See
  ;; <https://github.com/magit/magit/issues/3832>.
  (dolist (command '(magit-commit magit-merge magit-cherry-pick
		     magit-revert magit-am magit-rebase))
    (transient-append-suffix command ["-S"]
      '("=S" "Don't sign using gpg" "--no-gpg-sign"))))

;;; Rainbow Delimiters ;;;
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)

;;; Rust ;;;
(add-hook 'rust-mode-hook (lambda () (setq indent-tabs-mode nil)))

;;; save-some-buffers ;;;
;; Allow reverting buffers directly from the "Save file ...?" message.
(add-to-list 'save-some-buffers-action-alist
  `(?r ,(lambda (buf) (with-current-buffer buf (revert-buffer t t)))
       ,(purecopy "revert this buffer")))

;;; Transient ;;;
;; Make all Magit options available, even those that are disabled by
;; default because they're too obscure.
(setq transient-default-level 7)