Compare commits

..

75 commits

Author SHA1 Message Date
b8adef76fb chore: update gitignore with compile elpa files, org-roam-db, ... 2025-08-14 11:44:38 +02:00
53aa91408c fix: which-func custom setting 2025-08-14 11:44:30 +02:00
06208d5491 feat: Display function name in header as well 2025-07-24 10:24:54 +02:00
423acecb38 replace whitespace-cleanup with delete-trailing-whitespace
whitespace-cleanup seems to do some formatting, tabs-to-whitespace and
vice versa,... which are kinda annoying.

We should be fine for now with just removing trailing whitespaces.
2025-07-24 10:24:01 +02:00
706b396e1c feat: load org-roam at startup 2025-05-27 14:06:22 +02:00
b79d782623 feat: Make dashboard a bit fancier 2025-05-27 14:06:08 +02:00
8ba598127b feat: show line numbers 2025-05-27 13:49:51 +02:00
4aeb92eb6f feat: Add which-func configuration 2025-05-27 13:06:26 +02:00
c3a188defe fix: Remove unused mark section
M-SPC is used for selecting region anyway
2025-05-27 13:06:08 +02:00
0c18e02686 fix: liniting errors on init.el 2025-05-27 12:55:07 +02:00
6a57cbfd1f feat: Add custom modeline 2025-05-27 12:51:50 +02:00
015ed00b0f feat: refactor org mode configuration
Defer loading to speed up startup and combine all the configuration of
org mode in the same block.

org-ellipsis is newly added and gives some eye candy when org blocks
are folded.
2025-05-27 12:51:50 +02:00
980ce6750b feat: Add paren package configuration
show-paren-context-when-offscreen is handy to indicate when we are
offscreen for a block of code
2025-05-27 12:51:50 +02:00
28b6168110 fix: refeactor electric pair
It's a built-in package, so we can provide a proper configuration
section using use-package.
2025-05-27 12:51:50 +02:00
c809f480bd fix: load theme after it is actually loaded, not at init time 2025-05-27 12:51:50 +02:00
3591e5704e fix: remove/apply defer only where it makes sense
:defer is to defer loading because some other action (hook/config/...)
will load it when appropriate.
2025-05-27 12:51:50 +02:00
e6e5b5e461 feat: Remove org-roam-ui
Not using it, so don't have it.
2025-05-27 12:51:50 +02:00
a79987f30f chore: stylefix 2025-05-27 12:51:50 +02:00
3f93a19d4b feat: enable corfu iso company-mode
No issues so far when using melpa iso latest git repo (elpaca behaviour)
2025-05-27 12:51:50 +02:00
80b3e4dbc1 feat: enable vertico-cycle and call hook when appropriate 2025-05-27 12:51:50 +02:00
377a5cadff fix: whitespace has a separate built-in package
It has a better hook (whitespace-cleanup) than the barebones delete-trailing-whitespace.
2025-05-27 12:51:50 +02:00
adab1147e0 fix: Docs on keys to use when resizing 2025-05-27 12:51:50 +02:00
7f901b23ae feat: Remove elpaca
I'm not actually using it and it's just bloat at this point.
This speeds up the startup significantly.

Remove what you don't need.
2025-05-27 12:51:50 +02:00
a731bab651 Only pop-up messages buffer if there is an error 2025-05-26 10:59:45 +02:00
2572e8c221 Fix linting warnings in early-init/init.el
There should be no functional changes
2025-05-26 10:59:38 +02:00
6c24da4503 Rework eglot configuration to use built-in package 2025-05-25 17:26:38 +02:00
f2dc1fe496 Add flymake configuration 2025-05-25 17:26:30 +02:00
49a5164f45 Rework isearch configuration using emacs-solo inspiration 2025-05-25 17:26:06 +02:00
22c029b2f4 Remove old eldoc/jsonrpc workarounds and just use built-in packages 2025-05-25 17:25:41 +02:00
ff740ce08e feat: Add org-download 2025-04-30 09:40:43 +02:00
1a21781fba fix: switch back to company from corfu to avoid random crash
It seems like a known issue (don't have the link anymore..) but
company is doing fine for now so just switch back to it.
2025-04-30 09:39:47 +02:00
d3dc9465dd fix: load init.el of notes repo when org-roam is properly loaded
This avoids all kinds of issues about variables not being declared,
etc. in the project-notes init.el
2025-04-30 09:38:32 +02:00
f5ef8d68c5 fix: Update visit/reload-config docs 2025-04-30 09:37:32 +02:00
0b57fa79b5 feat: Update elpaca
This avoids the warning at startup about not being able to determine
elpaca core date.
2025-04-30 09:36:55 +02:00
c47c5a5185 fix: revert-mode setting 2025-01-09 21:11:48 +01:00
17e062e07f Add font and icon/nerd-font section 2025-01-09 20:55:30 +01:00
ede533e792 Use load-file option for custom file and notes iso manual check 2025-01-09 20:54:56 +01:00
3853d9d247 fix: close minibuffer if open when pressing C-g 2025-01-09 20:54:56 +01:00
c8fa26b07b feat(corfu): make <tab> execute complete 2025-01-09 20:54:56 +01:00
7252361ab1 feat(consult): enable 2025-01-09 20:54:56 +01:00
275d07b961 feat(buffer-completion): replace company-mode with corfu 2025-01-09 20:54:56 +01:00
e692a9de93 add(org-roam): custom command to filter on a tag 2025-01-07 22:05:46 +01:00
28dae3bfeb add(org-roam): don't limit tags to 10 chars 2025-01-07 22:05:29 +01:00
cea6f3f2c0 add(org-roam): enable db autosync mode 2025-01-07 21:48:45 +01:00
0e722c06b5 add(org-roam): show tags in org-roam-node-find
This allows us to search for them as well
2025-01-07 21:47:58 +01:00
34e4462f1b add(yas): enable also in text-mode 2025-01-07 21:47:39 +01:00
2023ec08b3 add(snippets): Add kaboom snippet for c-mode 2024-12-21 19:54:33 +01:00
7285b8750e feat: load init.el from (org-)notes repo if it exists 2024-11-17 19:27:45 +01:00
ad0adbc726 feat: Enable global auto-revert mode 2024-11-04 09:43:21 +01:00
75bda91171 In-buffer-completion: Add company-mode 2024-10-17 21:59:48 +02:00
a68f566cd9 In-buffer-completion: Disable corfu
Getting crashes with emacs 29.4, seems to be a known issue.
Until emacs 30, find another in-buffer-completion solution.
2024-10-17 21:59:09 +02:00
a5efd66ec7 In-buffer-completion: Add consult completion method 2024-10-17 21:58:59 +02:00
40d9146a45 In-buffer-completion: Add separate section 2024-10-17 21:58:34 +02:00
d0657174dc Update org-agenda-files with todo.org inside org-roam-directory 2024-09-29 22:58:41 +02:00
3ad176fbf9 ORG-TODO: Mark parent task done if child tasks are done 2024-09-29 22:02:19 +02:00
6aaae92c53 ADD filetags snippet 2024-09-29 22:02:16 +02:00
934c375c34 ADD org-roam-dailies-goto-today keybinding 2024-09-29 15:13:45 +02:00
1521fcb13e ADD jsonrpc section
This is a built-in package which we are updating for eglot.
2024-09-27 16:13:47 +02:00
21fbc47a8f ADD eldoc section
This is a built-in package which we are updating for eglot.
This requires some emacs-fu which I found on the elpaca github.
2024-09-27 16:13:47 +02:00
1a99cb8ccb ELPACA: Wait until use-package integration fully loaded
Stolen from github:
https://github.com/progfolio/elpaca/issues/236

If the maintainer does it, it probably is needed.
2024-09-27 15:50:10 +02:00
ce1c827f4c ELPACA: Add sub-titles 2024-09-27 15:49:58 +02:00
62148f96ca Simplify keys for org-mode source block snippets 2024-09-27 10:08:33 +02:00
8b1d672215 FIX org-mode source block snippets 2024-09-27 10:07:52 +02:00
e837ce7551 ENABLE consult-find 2024-09-26 22:48:20 +02:00
f82e59591e ENABLE consult-flymake 2024-09-26 22:47:05 +02:00
83dc765086 ENABLE consult-compile-error 2024-09-26 22:46:53 +02:00
1022956e46 ENABLE consult-grep 2024-09-26 22:30:48 +02:00
32ddb062c0 ORG_ROAM: Add consult integration 2024-09-26 22:21:26 +02:00
bbffcd8d2b DIRED: Add guessing of target directory 2024-09-26 22:21:11 +02:00
6127374888 ORG_ROAM: Add completion everywhere
That way, when we type a part of the note name, we get an automatic
link/insert of the node.
2024-09-26 22:19:06 +02:00
8a5527c2d4 ADD org-roam + org-roam-ui 2024-09-25 23:44:37 +02:00
c5cebd2147 REMOVE logo
Img is bloat
2024-09-24 22:22:47 +02:00
5ca1559c20 Move cheat-sheet to inside config.org 2024-09-24 22:21:56 +02:00
3c24cac0c1 DELETE sunrise-commander
Not using it, maybe somewhere in the future, I'll re-enable/add it.
2024-09-24 22:08:36 +02:00
Laurens Miers
b0b017251c Merge pull request #7 from laurensmiers/unclutter
Unclutter/refresh config
2024-09-24 22:01:13 +02:00
12 changed files with 583 additions and 255 deletions

5
.gitignore vendored
View file

@ -3,6 +3,11 @@ backups
eshell
elpaca
eln-cache
elpa
org-roam.db
transient
# projectile
projectile*

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "extra/sunrise-commander"]
path = extra/sunrise-commander
url = https://github.com/escherdragon/sunrise-commander

View file

@ -1,8 +0,0 @@
C-M-Space : smartparens wrapping
C-c C-c : calculator (see init.el)
C-h k <key-sequence>: lookup key sequence
C-x 0 : close current window
C-q <tab> : insert a <tab>
M-x (un)tabify : (replace) tabs
M-x describe-bindings : list of all mapped keys/commands
M-p : fill-paragraph, works for doxygen as well

View file

@ -2,61 +2,62 @@
#+TITLE: My Emacs
#+CREATOR: Laurens Miers
#+LANGUAGE: en
[[./img/dash_logo.png]]
* Elpaca
#+begin_src emacs-lisp
(defvar elpaca-installer-version 0.7)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil :depth 1
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (apply #'call-process `("git" nil ,buffer t "clone"
,@(when-let ((depth (plist-get order :depth)))
(list (format "--depth=%d" depth) "--no-single-branch"))
,(plist-get order :repo) ,repo))))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
#+end_src
#+begin_src emacs-lisp
;; Install use-package support
(elpaca elpaca-use-package
;; Enable use-package :ensure support for Elpaca.
(elpaca-use-package-mode)
)
#+end_src
* General config
#+BEGIN_SRC emacs-lisp
(use-package emacs
:ensure nil
:custom
(inhibit-startup-message t)
:init
(with-current-buffer (get-buffer-create "*scratch*")
(insert (format ";;
;; ██╗ ██╗███████╗██╗ ██╗ ██████╗
;; ██║ ██║██╔════╝██║ ██║ ██╔═══██╗
;; ███████║█████╗ ██║ ██║ ██║ ██║
;; ██╔══██║██╔══╝ ██║ ██║ ██║ ██║
;; ██║ ██║███████╗███████╗███████╗╚██████╔╝
;; ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ ╚═════╝
;;
;; ███████╗███╗ ███╗ █████╗ ██████╗███████╗
;; ██╔════╝████╗ ████║██╔══██╗██╔════╝██╔════╝
;; █████╗ ██╔████╔██║███████║██║ ███████╗
;; ██╔══╝ ██║╚██╔╝██║██╔══██║██║ ╚════██║
;; ███████╗██║ ╚═╝ ██║██║ ██║╚██████╗███████║
;; ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝
;;
;; Loading time : %s
;; Packages : %s
;;
"
(emacs-init-time)
(number-to-string (length package-activated-list)))))
(message (emacs-init-time))
)
#+END_SRC
** Package repos
#+BEGIN_SRC emacs-lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
#+END_SRC
** Use-package
*** Always ensure
#+BEGIN_SRC emacs-lisp
(require 'use-package-ensure)
(setq use-package-always-ensure t)
#+END_SRC
** Bell
The audible bell is annoying AF.
@ -71,10 +72,15 @@ The audible bell is annoying AF.
(setq column-number-mode 1)
#+END_SRC
** Delete trailing whitespaces
** Whitespace cleanup
#+BEGIN_SRC emacs-lisp
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(use-package whitespace
:ensure nil
:hook (before-save-hook . delete-trailing-whitespace)
;; if we wanna remove this hook at any time, eval:
;; (remove-hook 'before-save-hook #'whitespace-cleanup)
)
#+END_SRC
** Save history and recent files
@ -145,22 +151,82 @@ Use list-buffers bigger brother.
(global-set-key [remap list-buffers] 'ibuffer)
#+end_src
** Mark
** Eldoc
#+begin_src emacs-lisp
(global-set-key (kbd "M-SPC") 'mark-word)
#+end_src
#+BEGIN_SRC emacs-lisp
(use-package eldoc
:ensure nil
:init
(global-eldoc-mode))
#+END_SRC
** Isearch
Display number of matches:
#+begin_src emacs-lisp
(setq-default isearch-lazy-count t)
#+end_src
Inspired by [[https://github.com/LionyxML/emacs-solo][emacs-solo]]:
#+BEGIN_SRC emacs-lisp
(use-package isearch
:ensure nil
:config
(setq isearch-lazy-count t) ; Display number of matches
(setq lazy-count-prefix-format "(%s/%s) ") ; eye-candy to add braces
(defun isearch-copy-selected-word ()
"Copy the current `isearch` selection to the kill ring."
(interactive)
(when isearch-other-end
(let ((selection (buffer-substring-no-properties isearch-other-end (point))))
(kill-new selection)
(isearch-exit))))
;; Bind `M-w` in isearch to copy the selected word, so M-s M-. M-w
;; does a great job of 'copying the current word under cursor'.
(define-key isearch-mode-map (kbd "M-w") 'isearch-copy-selected-word))
#+END_SRC
Reference that might be interesting for later:
https://endlessparentheses.com/leave-the-cursor-at-start-of-match-after-isearch.html
** Flymake
#+BEGIN_SRC emacs-lisp
(use-package flymake
:ensure nil
:defer t
:hook
(prog-mode-hook . flymake-mode)
:custom
(flymake-show-diagnostics-at-end-of-line 'short)
(flymake-indicator-type 'margins)
(flymake-margin-indicators-string
`((error "!" compilation-error)
(warning "?" compilation-warning)
(note "i" compilation-info))
)
)
#+END_SRC
** Which-func
Show function we are currently in in the mode-line.
#+BEGIN_SRC emacs-lisp
(use-package which-func
:ensure nil
:defer t
:custom
(which-func-display 'mode-and-header)
:hook
(prog-mode-hook . which-function-mode)
)
#+END_SRC
** Line-numbers
Show line numbers.
#+BEGIN_SRC emacs-lisp
(global-display-line-numbers-mode t)
#+END_SRC
** Abbrev
#+begin_src emacs-lisp
@ -197,15 +263,6 @@ Narrow-region/page is a really handy feature, enable it:
(put 'narrow-to-region 'disabled nil)
#+END_SRC
** Use-package
*** Always ensure
#+BEGIN_SRC emacs-lisp
(require 'use-package-ensure)
(setq use-package-always-ensure t)
#+END_SRC
** Adaptive cursor width
Make cursor the width of the character it is under f.e. full width of a tab.
@ -214,6 +271,12 @@ Make cursor the width of the character it is under f.e. full width of a tab.
(setq x-stretch-cursor t)
#+END_SRC
** Enable auto-revert
#+BEGIN_SRC emacs-lisp
(global-auto-revert-mode t)
#+END_SRC
* Resize-mode
Minor-mode to easily resize frames (works with EXWM (firefox, ...)).
@ -260,7 +323,7 @@ C-c C-c to apply."
(if (<= (length (window-list)) 1)
(progn (setq resize-frame nil)
(message "Only root frame exists, abort."))
(message "Use arrow-keys or i/j/k/l to adjust frames.")))
(message "Use arrow-keys or C-p/n/f/b to adjust frames.")))
(defun resize-frame-done ()
(interactive)
@ -274,15 +337,14 @@ C-c C-c to apply."
** Minibuffer
#+BEGIN_SRC emacs-lisp
;; Enable vertico
(use-package vertico
;; :custom
:custom
;; (vertico-scroll-margin 0) ;; Different scroll margin
;; (vertico-count 20) ;; Show more candidates
;; (vertico-resize t) ;; Grow and shrink the Vertico minibuffer
;; (vertico-cycle t) ;; Enable cycling for `vertico-next/previous'
:init
(vertico-mode))
(vertico-cycle t) ;; Enable cycling for `vertico-next/previous'
:hook (after-init . vertico-mode)
)
#+END_SRC
** Consult
@ -312,8 +374,8 @@ C-c C-c to apply."
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
;; M-g bindings in `goto-map'
;; ("M-g e" . consult-compile-error)
;; ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ;; orig. goto-line
("M-g M-g" . consult-goto-line) ;; orig. goto-line
;; ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
@ -322,9 +384,9 @@ C-c C-c to apply."
("M-i" . consult-imenu)
("M-I" . consult-imenu-multi)
;; M-s bindings in `search-map'
;; ("M-s d" . consult-find) ;; Alternative: consult-fd
("M-s d" . consult-find) ;; Alternative: consult-fd
;; ("M-s c" . consult-locate)
;; ("M-s g" . consult-grep)
("M-s g" . consult-grep)
;; ("M-s G" . consult-git-grep)
;; ("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
@ -395,11 +457,27 @@ C-c C-c to apply."
)
#+END_SRC
** Corfu
** In-buffer completion
*** Consult
#+BEGIN_SRC emacs-lisp
(setq completion-in-region-function
(lambda (&rest args)
(apply (if vertico-mode
#'consult-completion-in-region
#'completion--in-region)
args)))
#+END_SRC
*** Corfu
#+BEGIN_SRC emacs-lisp
(use-package corfu
;; Optional customizations
:bind (:map corfu-map ("<tab>" . corfu-complete))
:config
(setq tab-always-indent 'complete)
:custom
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
(corfu-auto t) ;; Enable auto completion
@ -425,7 +503,7 @@ C-c C-c to apply."
** Orderless
#+begin_src emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package orderless
:demand t
:custom
@ -445,11 +523,11 @@ C-c C-c to apply."
;; )
;; )
)
#+end_src
#+END_SRC
** Marginalia
#+begin_src emacs-lisp
#+BEGIN_SRC emacs-lisp
;; Enable rich annotations using the Marginalia package
(use-package marginalia
;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding
@ -464,7 +542,7 @@ C-c C-c to apply."
;; the mode gets enabled right away. Note that this forces loading the
;; package.
(marginalia-mode))
#+end_src
#+END_SRC
* Dired
@ -475,7 +553,7 @@ C-c C-c to apply."
(require 'dired-x)
;; Set dired-x global variables here. For example:
;; (setq dired-x-hands-off-my-keys nil)
))
)
(add-hook 'dired-mode-hook
(lambda ()
@ -484,6 +562,15 @@ C-c C-c to apply."
))
#+end_src
** Guess target directory
I currently prefer to have two dired windows open in the same frame.
Instruct dired to 'Prefer next windows on the same frame' when renaming/copying files.
#+BEGIN_SRC emacs-lisp
(setq dired-dwim-target 'dired-dwim-target-next)
#+END_SRC
* Whole-line-or-region
Source:
@ -493,7 +580,6 @@ Operate on the current line if no region is active.
#+begin_src emacs-lisp
(use-package whole-line-or-region
:config
(whole-line-or-region-global-mode 1)
)
@ -546,8 +632,7 @@ For the keybindings, we have to defien them in both raw and line mode. From the
#+BEGIN_SRC emacs-lisp
(use-package monokai-theme
:init
:config
(load-theme 'monokai t)
)
#+END_SRC
@ -556,30 +641,32 @@ For the keybindings, we have to defien them in both raw and line mode. From the
#+begin_src emacs-lisp
(use-package dashboard
:custom
(dashboard-center-content t) ;; Center content
(dashboard-icon-type 'nerd-icons) ;; Nerd icons used
(dashboard-set-heading-icons t) ;; Heading icons enabled
(dashboard-set-file-icons t) ;; File icons enabled
(dashboard-startup-banner 'logo) ;; Use alternative logo
:config
(add-hook 'elpaca-after-init-hook #'dashboard-insert-startupify-lists)
(add-hook 'elpaca-after-init-hook #'dashboard-initialize)
(dashboard-setup-startup-hook))
#+end_src
* Hydra
Install and wait for hydra to be available since we are using it in this init.el :
#+begin_src emacs-lisp
https://github.com/abo-abo/hydra
#+BEGIN_SRC emacs-lisp
(use-package hydra
:ensure (:wait t)
)
#+end_src
** Text zoom
#+begin_src emacs-lisp
(defhydra hydra-zoom (global-map "<f1>")
:config
;; Zoom hydra
(defhydra hydra-zoom (global-map "<f1>")
"zoom"
("g" text-scale-increase "in")
("l" text-scale-decrease "out")
)
#+end_src
)
)
#+END_SRC
* Zygospore
@ -631,15 +718,34 @@ https://github.com/victorhge/iedit
#+END_SRC
** Electric pair
#+BEGIN_SRC emacs-lisp
(add-hook 'prog-mode-hook 'electric-pair-mode)
(use-package elec-pair
:ensure nil
:defer t
:hook (prog-mode-hook . electric-pair-mode))
#+END_SRC
** Paren
#+BEGIN_SRC emacs-lisp
(use-package paren
:ensure nil
:hook (after-init-hook . show-paren-mode)
:custom
(show-paren-delay 0)
(show-paren-style 'mixed)
(show-paren-context-when-offscreen t)) ;; show matches within window splits
#+END_SRC
** Eglot
#+BEGIN_SRC emacs-lisp
(use-package eglot)
(use-package eglot
:ensure nil
:custom
(eglot-autoshutdown t)
:init
(setq eglot-stay-out-of '(xref))
(add-hook 'prog-mode-hook 'eglot-ensure)
(add-hook 'eglot-managed-mode-hook (lambda ()
@ -647,12 +753,17 @@ https://github.com/victorhge/iedit
(add-hook 'xref-backend-functions 'eglot-xref-backend)
(remove-hook 'xref-backend-functions 'eglot-xref-backend)
)))
)
#+END_SRC
** Markdown-mode
#+BEGIN_SRC emacs-lisp
(use-package markdown-mode)
(use-package markdown-mode
:defer t
)
#+END_SRC
@ -663,6 +774,7 @@ https://github.com/victorhge/iedit
:hook
(prog-mode . yas-minor-mode)
(org-mode . yas-minor-mode)
(text-mode . yas-minor-mode)
:config
(yas-reload-all)
)
@ -670,48 +782,22 @@ https://github.com/victorhge/iedit
** Magit
*** Transient
Magit depends on this and it seems it's not installed as a dependency, so install it explicitly.
#+BEGIN_SRC emacs-lisp
(use-package transient
:ensure (:wait t)
)
#+END_SRC
*** Core
#+BEGIN_SRC emacs-lisp
(use-package magit
:ensure (:wait t)
)
:defer t
)
#+END_SRC
**** Extra commands
***** Update all submodules
#+BEGIN_SRC emacs-lisp
(transient-define-suffix magit-submodule-update-all ()
"Update all submodules"
:description "Update All git submodule update --init --recursive"
(interactive)
(magit-with-toplevel
(magit-run-git-async "submodule" "update" "--force")))
(transient-append-suffix 'magit-submodule "f"
'("U" magit-submodule-update-all))
#+END_SRC
** Dumb-jump
#+BEGIN_SRC emacs-lisp
(use-package dumb-jump
(use-package dumb-jump
:init
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
)
)
#+END_SRC
** C-programming
@ -741,6 +827,7 @@ Move to the end if the compilation finishes.
#+BEGIN_SRC emacs-lisp
(use-package rust-mode
:defer t
:init
(setq rust-mode-treesitter-derive t))
#+END_SRC
@ -748,13 +835,17 @@ Move to the end if the compilation finishes.
** Zig
#+BEGIN_SRC emacs-lisp
(use-package zig-mode)
(use-package zig-mode
:defer t
)
#+END_SRC
** Python
#+BEGIN_SRC emacs-lisp
(use-package python-mode)
(use-package python-mode
:defer t
)
#+END_SRC
* Multiple cursors
@ -791,8 +882,8 @@ https://github.com/remyferre/comment-dwim-2
#+BEGIN_SRC emacs-lisp
(use-package comment-dwim-2
:config
(global-set-key (kbd "M-;") 'comment-dwim-2)
:bind
("M-;" . comment-dwim-2)
)
#+END_SRC
@ -808,36 +899,117 @@ https://github.com/remyferre/comment-dwim-2
(add-hook 'project-find-functions #'project-projectile)
)
#+END_SRC
* Org
** General config
*** Super/Sub-scripts
Use ={}= for subscripting:
https://orgmode.org/manual/Subscripts-and-superscripts.html
#+BEGIN_SRC emacs-lisp
(setq org-use-sub-superscripts '{})
(use-package org
:ensure nil
:defer t
:mode ("\\.org\\'" . org-mode)
:config
(setq
;; Start collapsed for speed
org-startup-folded t
;; Use ={}= for subscripting: https://orgmode.org/manual/Subscripts-and-superscripts.html
org-use-sub-superscripts '{}
;; Preserve indentation in SRC blocks
org-src-preserve-indentation t
)
;; Ellipsis styling
(setq org-ellipsis " ▼ ")
(set-face-attribute 'org-ellipsis nil :inherit 'default :box nil))
#+END_SRC
*** Indentation
** Org-todo
Preserve indentation in SRC blocks
*** Mark parent entry as DONE when children are DONE
#+BEGIN_SRC emacs-lisp
(setq org-src-preserve-indentation t)
(defun org-summary-todo (n-done n-not-done)
"Switch entry to DONE when all subentries are done, to TODO otherwise."
(let (org-log-done org-todo-log-states) ; turn off logging
(org-todo (if (= n-not-done 0) "DONE" "TODO"))))
(add-hook 'org-after-todo-statistics-hook #'org-summary-todo)
#+END_SRC
** Org bullets
#+BEGIN_SRC emacs-lisp
(use-package org-bullets
:defer t
:after org
:config
(add-hook 'org-mode-hook (lambda () (org-bullets-mode))))
#+END_SRC
** Org Roam
#+BEGIN_SRC emacs-lisp
(use-package org-roam
:demand
:custom
(org-roam-directory "~/projects/notes")
(org-roam-completion-everywhere t)
:config
(org-roam-setup)
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags}" 'face 'org-tag)))
(org-roam-db-autosync-mode)
;; Add todo lists to org-agenda
(custom-set-variables '(org-agenda-files (directory-files-recursively org-roam-directory "todo\\.org$")))
(load (expand-file-name "init.el" org-roam-directory) :no-error-if-file-is-missing)
)
#+END_SRC
*** Consult
#+BEGIN_SRC emacs-lisp
(use-package consult-org-roam
:ensure t
:after org-roam
:init
(require 'consult-org-roam)
;; Activate the minor mode
(consult-org-roam-mode 1)
;; :custom
;; Use `ripgrep' for searching with `consult-org-roam-search'
;; (consult-org-roam-grep-func #'consult-ripgrep)
;; Configure a custom narrow key for `consult-buffer', default is 'n', this sets it to 'r'
;; (consult-org-roam-buffer-narrow-key ?r)
;; Display org-roam buffers right after non-org-roam buffers
;; in consult-buffer (and not down at the bottom)
;; (consult-org-roam-buffer-after-buffers t)
:config
;; Eventually suppress previewing for certain functions
(consult-customize
consult-org-roam-forward-links
:preview-key "M-.")
:bind
;; Define some convenient keybindings as an addition
("C-c n f" . consult-org-roam-file-find)
("C-c n b" . consult-org-roam-backlinks)
("C-c n B" . consult-org-roam-backlinks-recursive)
("C-c n l" . consult-org-roam-forward-links)
("C-c n s" . consult-org-roam-search)
("C-c n d" . org-roam-dailies-goto-today)
)
#+END_SRC
** Org Download
#+BEGIN_SRC emacs-lisp
(use-package org-download
:defer t
:after org
:config
(add-hook 'dired-mode-hook 'org-download-enable)
)
#+END_SRC
* Elisp
** Add demos to describe-function
@ -851,6 +1023,91 @@ Preserve indentation in SRC blocks
* Custom
** Modeline
#+BEGIN_SRC emacs-lisp
(setq-default mode-line-format
'("%e" " "
;; (:propertize " " display (raise +0.1)) ;; Top padding
;; (:propertize " " display (raise -0.1)) ;; Bottom padding
(:propertize "𝝮 " face font-lock-keyword-face)
(:propertize
("" mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-window-dedicated))
mode-line-frame-identification
mode-line-buffer-identification
" "
mode-line-position
mode-line-format-right-align
" "
(project-mode-line project-mode-line-format)
" "
(vc-mode vc-mode)
" "
mode-line-modes
mode-line-misc-info
mode-line-end-spaces)
project-mode-line t
mode-line-buffer-identification '(" %b")
mode-line-position-column-line-format '(" %l:%c"))
#+END_SRC
** Org-roam
Inspired by https://github.com/org-roam/org-roam/wiki/User-contributed-Tricks#filter-by-a-tag .
#+BEGIN_SRC emacs-lisp
(defun myrmi/org-roam-node-find-tag-filter ()
"Select a single tag from list and filter `org-roam-node' by it."
(interactive)
(let ((tag (car (completing-read-multiple "Tag: "
(org-roam-tag-completions)))))
(org-roam-node-find nil nil
(lambda (node)
(member tag
(org-roam-node-tags node))))))
#+END_SRC
** Font
'Inspired' by https://protesilaos.com/codelog/2024-11-28-basic-emacs-configuration/#h:1e4fde73-a2a2-4dc5-82ad-02cf3884ece6 .
#+BEGIN_SRC emacs-lisp
(let ((mono-spaced-font "Monospace")
(proportionately-spaced-font "Sans"))
(set-face-attribute 'default nil :family mono-spaced-font :height 100)
(set-face-attribute 'fixed-pitch nil :family mono-spaced-font :height 1.0)
(set-face-attribute 'variable-pitch nil :family proportionately-spaced-font :height 1.0))
#+END_SRC
*** Icon fonts
To make this setup work, the user must type M-x and then call the
command 'nerd-icons-install-fonts'. This will store the icon font files
in a local directory (on Linux this is ~/.local/share/fonts).
#+BEGIN_SRC emacs-lisp
(use-package nerd-icons
:ensure t)
(use-package nerd-icons-completion
:ensure t
:after marginalia
:config
(add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup))
(use-package nerd-icons-corfu
:ensure t
:after corfu
:config
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(use-package nerd-icons-dired
:ensure t
:hook
(dired-mode . nerd-icons-dired-mode))
#+END_SRC
** Sudo current buffer
#+BEGIN_SRC emacs-lisp
@ -866,7 +1123,6 @@ Preserve indentation in SRC blocks
)
#+END_SRC
** Save symbol at point
#+BEGIN_SRC emacs-lisp
@ -939,12 +1195,58 @@ This should normally be done by the init.el to load this configuration.
#+BEGIN_SRC emacs-lisp
(defun myrmi/visit-config ()
"Reloads ~/.emacs.d/config.org at runtime"
"Visit emacs config"
(interactive)
(find-file my-config-file))
(defun myrmi/reload-config ()
"Reloads ~/.emacs.d/config.org at runtime"
"Reload emacs config at runtime"
(interactive)
(org-babel-load-file my-config-file))
#+END_SRC
** Tips and Tricks
*** Cheat-sheet
| Key | Explanation |
|-----------------------+-----------------------------------------------------------|
| C-h k <key-sequence> | Lookup key sequencesmartparens wrapping |
| C-q <key> | Insert <key> quoted/explicitly. F.e. to insert a tab, ... |
| M-x untabify/tabify | Convert to spaces/tabs |
| M-x describe-bindings | List all mapped keys/commands |
| M-q | Fill paragraph |
** Minibuffer
*** Close minibuffer when pressing C-g
'Inspired' by https://protesilaos.com/codelog/2024-11-28-basic-emacs-configuration/#h:1e4fde73-a2a2-4dc5-82ad-02cf3884ece6 .
#+BEGIN_SRC emacs-lisp
(defun myrmi/keyboard-quit-dwim ()
"Do-What-I-Mean behaviour for a general `keyboard-quit'.
The generic `keyboard-quit' does not do the expected thing when
the minibuffer is open. Whereas we want it to close the
minibuffer, even without explicitly focusing it.
The DWIM behaviour of this command is as follows:
- When the region is active, disable it.
- When a minibuffer is open, but not focused, close the minibuffer.
- When the Completions buffer is selected, close it.
- In every other case use the regular `keyboard-quit'."
(interactive)
(cond
((region-active-p)
(keyboard-quit))
((derived-mode-p 'completion-list-mode)
(delete-completion-window))
((> (minibuffer-depth) 0)
(abort-recursive-edit))
(t
(keyboard-quit))))
(define-key global-map (kbd "C-g") #'myrmi/keyboard-quit-dwim)
#+END_SRC

View file

@ -1,9 +1,18 @@
;;; early-init.el --- Early Init -*- lexical-binding: t; -*-
;;; Commentary:
;; Early init configuration for Emacs Solo
;;
;;; Code:
;; Only care about errors in *Messages* buffer
(setq warning-minimum-level :error)
;; We control when packages are enabled
(setq package-enable-at-startup nil)
(provide 'early-init)
;; Local Variables:
;; no-byte-compile: t
;; no-native-compile: t
;; no-update-autoloads: t
;; End:
;;; early-init.el ends here

@ -1 +0,0 @@
Subproject commit cf8305a149a321d028858057e7a7c92f0038a06a

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

16
init.el
View file

@ -1,3 +1,12 @@
;;; init.el --- Init -*- lexical-binding: t; -*-
;;; Commentary:
;;; Load init files
;;; Code:
;;; Increase garbage collection threshold during init but leave it to the default value after
;;; There are a LOT of articles/sites/... discussing this:
;;; https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/
@ -11,6 +20,9 @@
(when (file-readable-p my-config-file)
(org-babel-load-file (expand-file-name my-config-file)))
(when (file-readable-p custom-file)
(load custom-file))
(load custom-file :no-error-if-file-is-missing)
)
(provide 'init)
;;; init.el ends here

6
snippets/c-mode/kaboom Normal file
View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: kaboom
# key: kb
# --
char (*__kaboom)[sizeof($1)] = 1;

View file

@ -1,6 +1,6 @@
# -*- mode: snippet -*-
# name: Lisp source code block
# key: s>
# name: Start emacs source block
# key: se
# --
#+BEGIN_SRC emacs-lisp

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: Filetags
# key: ft
# --
#+FILETAGS: :$1:

View file

@ -1,8 +1,8 @@
# -*- mode: snippet -*-
# name: Start emacs source block
# key: se>
# name: Org source code block
# key: s
# --
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC
${1}
#+END_SRC