;;; init.el --- my emacs configuration -*- lexical-binding: t; -*-
;; Todo:
;; - Look at completion-preview-mode
;; - Look at grep-use-headings
;; - Look at elpa-openwith
(add-to-list 'load-path (expand-file-name (concat user-emacs-directory "site-lisp")))
;; Give me stats on garbage collection and startup time
(setopt garbage-collection-messages t)
(add-hook 'emacs-startup-hook
#'(lambda ()
(message (format "Initialised in %s seconds with %s garbage collections." (emacs-init-time) gcs-done))))
;; Use the gcmh to collect garbage when i'm not using emacs
(use-package gcmh
:ensure t
:custom
(gcmh-mode t))
(setopt user-full-name "noa")
(setopt user-mail-address "noa@noa.pub")
;; Properly distinguish these chords from their ascii legacy
(define-key input-decode-map [?\C-m] [C-m])
;;; Modern keybindings
;; A lot of people say that you get used to emacs keybindings over time, and this is true. But i find it hard to maintain two sets of keybindings in my head: those for emacs, and those for everything else. So i think that it's best to make emacs use the same bindings as everything else. For now, we do that with wakib mode.
(require 'wakib-keys)
(setopt wakib-keys t)
(with-eval-after-load 'wakib-keys
(add-hook 'after-change-major-mode-hook 'wakib-update-major-mode-map)
(add-hook 'menu-bar-update-hook 'wakib-update-minor-mode-maps)
;; Modifying other modules
;; When remap is used it exits isearch abruptly after first instance
;; Use explicit keybindings instead
(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
(define-key isearch-mode-map (kbd "C-S-f") 'isearch-repeat-backward)
(define-key isearch-mode-map (kbd "M-;") 'isearch-repeat-forward)
(define-key isearch-mode-map (kbd "M-:") 'isearch-repeat-backward)
(define-key isearch-mode-map (kbd "C-v") 'isearch-yank-kill)
(define-key isearch-mode-map (kbd "M-d") 'isearch-delete-char))
;;; Executing commands
;;I make my caps lock a menu key, so i can open the command palette with it:
(define-key context-menu-mode-map (kbd "