radix/files/emacs/init.el

230 lines
8.6 KiB
EmacsLisp
Raw Normal View History

2023-08-06 02:30:22 +00:00
;; Who am I?
(setq user-full-name "Luis Guilherme Coelho"
user-email-address "lgcoelho@disroot.org"
copyright-names-regexp (format "%s <%s>"
user-full-name
user-mail-address))
(load-file "~/projects/guix/etc/copyright.el")
;; Emacs directories
(setq user-emacs-directory "~/.config/emacs")
;; Organizing backups
(setq backup-directory-alist
'(("." . "~/.local/share/emacs/saves")))
;; Emacs load path
(add-to-list 'load-path
"~/.guix-profile/share/emacs/site-lisp")
(setq-default buffer-file-coding-system
'utf-8-unix)
;; Garbage collection
(setq gc-cons-threshold (* 50 1000 1000))
;; No more tabs
(setq-default indent-line-function 'insert-tab
indent-tabs-mode nil)
;; Profile emacs startup
(add-hook 'emacs-startup-hook
(lambda () (message
"*:** Emacs loaded in %s seconds with %d garbage collections."
(emacs-init-time "%.2f")
gcs-done)))
;; Disable compiler and large file warnings
(setq native-comp-async-report-warnings-errors nil
large-file-warning-threshold nil)
;; Remove start message and scratch message
(setq inhibit-startup-message t
initial-scratch-message nil)
;; Enable some minor modes globally
(dolist (mode '(server-mode ; Emacs server
savehist-mode ; Command history
column-number-mode ; Cursor column number
global-prettify-symbols-mode ; Pretty symbols
delete-selection-mode)) ; Normal selection behavior
(funcall mode 1))
;; Disable some minor modes globally
(dolist (mode '(tool-bar-mode menu-bar-mode ; Menus
scroll-bar-mode ; Scroll-bar
tooltip-mode ; Tooltip
indent-tabs-mode ; Tabs
blink-cursor-mode ; Cursor
fringe-mode)) ; Fringe
(funcall mode 0))
;; Line numbers settings
(setq display-line-numbers-type 'relative
display-line-numbers-current-absolute t
display-line-numbers-grow-only t
display-line-numbers-width-start t)
;; Display whitespaces
(setq-default fill-column 80)
(setq whitespace-display-mappings
'((space-mark ?\ [?⋅] [?.])
(space-mark ?\xA0 [?⋅] [?_])
(newline-mark ?\n [ ?\n] [?$ ?\n])
(tab-mark ?\t [ ?\t] [?\\ ?\t])))
(dolist (mode '(text-mode-hook
prog-mode-hook
conf-mode-hook))
(add-hook mode (lambda ()
(setq display-line-numbers-witdth
(length (format "%s" (count-lines (point-max)
(point-min)))))
(dolist (mode '(display-line-numbers-mode
rainbow-delimiters-mode
display-fill-column-indicator-mode
whitespace-mode))
(funcall mode 1)))))
(add-hook 'org-mode-hook
(lambda ()
(dolist (mode '(whitespace-mode
display-fill-column-indicator-mode))
(funcall mode 0))
(setq org-pretty-entities t)))
;; Aesthetics
(load-theme 'meimuna t)
(setq cursor-type 'box)
;; Smooth scroll
(setq scroll-step 1)
;; Please never show me a dialog box again
(setq use-dialog-box nil)
;; IRC
(setq circe-nick "anemofilia")
(setq circe-channels '("#emacs"
"#gnu"
"#guile"
"#guix"
"#libreboot"))
;; EMMS
(setq emms-player-list '(emms-player-mpv))
(require 'setup)
(setup-define :pkg
(lambda (feature-or-package)
`(unless (locate-file ,(symbol-name feature-or-package)
load-path
(get-load-suffixes))
(:package ',feature-or-package)))
:documentation "Install PACKAGE if it is not available locally.
This macro can be used as NAME, and it will replace itself with
the first PACKAGE."
:repeatable t
:shorthand #'cadr)
(setup-define :disabled
(lambda () `,(setup-quit))
:documentation "Always stop evaluating the body.")
(setup-define :load-after
(lambda (features &rest body)
(let ((body `(progn
(require ',(setup-get 'feature))
,@body)))
(dolist (feature (if (listp features)
(nreverse features)
(list features)))
(setq body `(with-eval-after-load ',feature ,body)))
body))
:documentation "Load the current feature after FEATURES."
:indent 1)
(setup-define :file-match
(lambda (regexp)
`(add-to-list 'auto-mode-alist (cons ,regexp ',(setup-get 'mode))))
:documentation "Associate the current mode with files that match REGEXP."
:debug '(form)
:repeatable t)
(setup-define :leader
(lambda (&rest args)
`(with-eval-after-load 'general
(general-define-key ,@args
:states 'normal
:keymaps 'override
:prefix "SPC"
:global-prefix "C-SPC")))
:documentation "Define a leader keybind"
:debug '(form)
:indent 0)
(setup-define :local-leader
(lambda (&rest args)
`(with-eval-after-load 'general
(let ((map ',(setup-get 'map)))
(general-define-key ,@args
:states 'normal
:keymaps map
:prefix "SPC m"
:global-prefix "C-SPC m"))))
:documentation "Define a local leader keybind"
:debug '(form)
:indent 0)
(setup-define :ignore-buffers
(lambda (&rest buffers)
`(setq ignored-buffers (append ignored-buffers ',buffers)))
:documentation "Ignore buffers")
(setup-define :display-rule
(lambda (condition &rest actions)
`(add-to-list 'display-buffer-alist '(,condition . ,actions)))
:documentation "Add to display buffer alist")
(setup (:pkg kakoune)
(:option ryo-modal-cursor-type 'box
ryo-modal-cursor-color "#8581E0")
(:global "<escape>"
(lambda ()
(interactive)
(if (minibufferp)
(keyboard-escape-quit)
(ryo-modal-mode))))
(kakoune-setup-keybinds)
(ryo-modal-keys
("M-s" mc/split-region)))
:
;; Use a real file manager
(setup (:pkg dirvish)
(:hook hl-line-mode)
(:option dirvish-attributes nil
dirvish-listing-switches '(--group-directories-first --classify))
;'(vc-state subtree-state all-the-icons collapse git-msg file-time file-size))
(dirvish-override-dired-mode))
(setup (:pkg org-bullets org-present org-roam org-modern))
(setup (:pkg elfeed elfeed-org))
(setup (:pkg geiser geiser-guile macrostep-geiser))
(setup (:pkg cape corfu corfu-doc consult-lsp vertico orderless))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes '(meimuna))
'(custom-safe-themes
'("5df271e8c563dcd5b7be07ab5b5a615567b20a36b7c748475df0bb512332f0e1" "c202b7618764218b8ecb21a13c5dc9b318f0879f54105847fa5e1868afb19369" "044d60490c760e63bd39232445702271257a47ab384a3871649ea03a3d2b430a" "322a73057be183963dcd4fbfaa859e636fc8aa5f76f2a24f32a8ee5cc73be484" "671f76d55e2917bcae38168c2363fc21a335683583543b3fe49018cf5542908d" "f2db82bef0fb3e3922053605326d82b3e6494aed5c938440358710e9b78da7d9" "47263df55a6df473a5b9ba13107523f285db25dbbfd793ed5beaf47b7ec11c8e" "452da09d018e5f7bffa1e293c224c8711aa37dc9e7dd1dce24c9be6a0f6067c3" "f2c28b88fc49c9577269afcfdbf4630135c2bc2a4813f379c9a8a3979953e706" "38d107472028475f6d47938a91abf170587b718f4ca84f258ea8d72babe25201" "12bd9d840d3e0f54c607ca63acca59b083eca3cb18b9e5c7b34dfb6a400eaf4b" default))
'(package-selected-packages
'(eat mines setup kakoune magit-popup edit-indirect bui geiser-guile auctex))
'(whitespace-style
'(face trailing tabs spaces lines lines-tail lines-char newline missing-newline-at-eof empty indentation::tab indentation::space indentation big-indent space-after-tab::tab space-after-tab::space space-after-tab space-before-tab::tab space-before-tab::space space-before-tab space-mark tab-mark newline-mark)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(whitespace-line ((t nil))))