about summary refs log tree commit diff
path: root/nix/hosts/caladan/emacs_config.el
blob: dc62586b907ad7531b23c4429399dbed80325b31 (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
(require 'package)
(package-initialize)
(add-to-list 'package-archives
  '("melpa" . "https://melpa.org/packages/") t)
(unless package-archive-contents
  (package-refresh-contents))

(dolist (package '(use-package sly corfu org))
  (unless (package-installed-p package)
    (package-install package)))

(when (display-graphic-p)
  (tool-bar-mode 0)
  (scroll-bar-mode 'left))

(load-theme 'leuven) ;; light theme
(setq pixel-scroll-precision-mode 1)
(xterm-mouse-mode 1)

(setq standard-indent 2)
(setq create-lockfiles nil)
(setq delete-old-versions -1)
(setq make-backup-files nil) ; stop creating ~ files
(setq version-control t)
(setq coding-system-for-write 'utf-8)
(setq-default indent-tabs-mode nil) ;; use spaces, not tabs
(setq show-paren-delay 0)
(show-paren-mode)

(setq custom-file (expand-file-name "custom.el" user-emacs-directory))

(add-to-list 'display-buffer-alist
             '("\\`\\*\\(Warnings\\|Compile-Log\\)\\*\\'"
               (display-buffer-no-window)
               (allow-no-window . t)))

(when (not (display-graphic-p))
      (menu-bar-mode -1))

;; general purpose emacs settings
(use-package emacs
  :init

  ;; do not allow cursor in the minibuffer prompt
  (setq minibuffer-prompt-properties
        '(read-only t cursor-intangible t face minibuffer-prompt))
  (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)

  ;; support opening new minibuffers from inside existing minibuffers
  (setq enable-recursive-minibuffers t)

  ;; Emacs 28 and newer: Hide commands in M-x which do not work in the current
  ;; mode. Vertico commands are hidden in normal buffers. This setting is
  ;; useful beyond Vertico.
  (setq read-extended-command-predicate #'command-completion-default-include-p))

;; org-mode
(use-package org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)

;; =============== plugins ==================

;; Corfu - COmpletion in Region FUnction
;; https://github.com/minad/corfu
(use-package corfu
  :custom
  (corfu-cycle-tab t)
  (corfu-auto t)
  (corfu-auto-prefix 2)
  (corfu-auto-delay 0.0)
  (corfu-quit-at-boundary 'separator)
  (corfu-echo-documentation 0.5)
  (corfu-preview-current 'insert)
  (corfu-preselect 'prompt)
  :bind (:map corfu-map
              ("M-SPC" . corfu-insert-separator)
              ("RET" . nil)
              ("TAB" . corfu-next)
              ([tab] . corfu-next)
              ("S-TAB" . corfu-previous)
              ([backtab] . corfu-previous)
              ("S-<return>" . corfu-insert))
  :init
  (global-corfu-mode)
  (corfu-history-mode)

  :config
  (add-hook 'eshell-mode-hook
            (lambda ()
              (setq-local corfu-quit-at-boundary t
                          corfu-quit-no-match t
                          corfu-auto nil)
              (corfu-mode))))

;; Marginalia - Marginalia in the minibuffer
;; https://github.com/minad/marginalia
(use-package marginalia
  :custom
  (marginalia-max-relative-age 0)
  (marginalia-align 'right)
  :init
  (marginalia-mode))

;; == Fancy icons ==
;; all-the-icons
;; https://github.com/domtronn/all-the-icons.el
(use-package all-the-icons
  :if (display-graphic-p))

;; ... also in completions 
(use-package all-the-icons-completion
  :after (marginalia all-the-icons)
  :hook (marginalia . all-the-icons-completion-marginalia-setup)
  :init (all-the-icons-completion-mode))

;; vectico.el - VERTical Interactive COmpletion
;; https://github.com/minad/vertico
(use-package vertico
  :init (vertico-mode)
  :custom (vertico-count 13)
  (vertico-resize t)
  (vertico-cycle nil)
  :config (vertico-mode))

;; orderless - completion
;; This allows searching for space separated terms in any order
;; https://github.com/oantolin/orderless
(use-package orderless
  :init (setq completion-styles '(orderless basic)
              completion-category-defaults nil
              completion-category-overrides '((file (styles partial-completion)))))
              


;; markdown mode
;; https://jblevins.org/projects/markdown-mode/
(use-package markdown-mode
  :ensure t
  :mode ("README\\.md\\'" . gfm-mode)
  :init (setq markdown-command "multimarkdown"))

;; Minibuffer with help when waiting too long
;; In emacs per default with Emacs v30
(use-package which-key
  :ensure t
  :config
  (setq which-key-idle-delay 0.1)
  (setq which-key-idle-secondary-delay 0.1)
  (which-key-mode))

;; flycheck - Syntax checking for GNU Emacs¶
;; https://www.flycheck.org/en/latest/
(use-package flycheck
  :ensure t
  :init (global-flycheck-mode))

;; allow the deletion of selected text (don't know why this isn't implemented by default)
(use-package delsel
  :ensure nil ; no need to install it as it is built-in, but needs to be activated
  :hook (after-init . delete-selection-mode))

;; Configure the Lisp program for SLIME
(add-to-list 'exec-path "/Users/emile/.nix-profile/bin")
(defvar inferior-lisp-program "sbcl")

;; configure parinfer to be enabled as a mode when the major lisp mode is enabled
(add-to-list 'load-path "/Users/emile/parinfer-rust")
(add-hook 'emacs-lisp-mode 'parinfer-rust-mode)
(add-hook 'emacs-lisp-mods (lambda () (lispy-mode 1)))

; pixel perfect ultra precise low latency scrolling
(use-package ultra-scroll
     ; if you git clone'd instead of package-vc-install
     ;:load-path "~/code/emacs/ultra-scroll"

     :init
     (setq scroll-conservatively 101 ; important!
         scroll-margin 0) 
     :config
     (ultra-scroll-mode 1))

(use-package breadcrumb
     :ensure t)

;(setq circe-network-options
;  '(("Libera Chat"
;     :tls t
;     :tls-keylist (("/Users/emile/libera.crt"
;                    "/Users/emile/libera.key"))
;     :sasl-external t
;     :nick "hanemile"
;     :channels ("#test"))))

(provide '.emacs)                       ; makes flycheck happy