commit d62023c1446ea66bcd46412995333ad963da79d4 Author: Alexander Rosenberg Date: Mon Sep 18 13:05:09 2023 -0700 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6895844 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/etc/ +/var/ diff --git a/early-init.el b/early-init.el new file mode 100644 index 0000000..083b6bc --- /dev/null +++ b/early-init.el @@ -0,0 +1,9 @@ +;;; early-init.el --- Things that need to run before init.el -*- lexical-binding: t -*- +;;; Commentary: +;;; Code: + +;; Move native compile cache to follor no-littering conventions +(when (fboundp 'startup-redirect-eln-cache) + (startup-redirect-eln-cache + (convert-standard-filename + (expand-file-name "var/eln-cache/" user-emacs-directory)))) diff --git a/init.el b/init.el new file mode 100644 index 0000000..0884565 --- /dev/null +++ b/init.el @@ -0,0 +1,251 @@ +;;; init.el --- Configuration entry point -*- lexical-binding: t -*- +;;; Commentary: +;;; Code: + +;; Set package dir to follow no-littering conventions +(setq package-user-dir "~/.emacs.d/var/elpa") + +;; Use melpa +(require 'package) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) +(package-initialize) + +;; Ensure use-package is installed +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + +;; use-package +(eval-when-compile + (setq use-package-always-ensure t) + (require 'use-package)) + +;; no-littering +(use-package no-littering + :config + (no-littering-theme-backups) + (setq custom-file (no-littering-expand-etc-file-name "custom.el"))) + +;; diminish +(use-package diminish + :config + (diminish 'abbrev-mode)) + +;; basic stuff +(use-package emacs + :hook (emacs-lisp-mode . (lambda () + (setq-local evil-lookup-func + #'my/describe-symbol-at-point))) + :init + (defun my/describe-symbol-at-point () + "Calls `describe-symbol' on the return value of `form-at-point'." + (interactive) + (describe-symbol (form-at-point))) + + ;; Make show paren instant + (setq show-paren-delay 0) + (show-paren-mode 1) + + ;; Display line numbers + (global-display-line-numbers-mode 1) + + ;; Show some more context arround the point + (setq scroll-margin 2) + + ;; Allow the frame to be any size + (setq frame-resize-pixelwise t) + + ;; Disable startup screen + (setq inhibit-startup-screen t) + + ;; rainbow-delimiters + (use-package rainbow-delimiters + :hook (prog-mode . rainbow-delimiters-mode)) + + ;; Disable the menu and tool bars + (menu-bar-mode -1) + (tool-bar-mode -1) + + ;; No scroll bars + (scroll-bar-mode -1) + + ;; Set fonts + (add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font Mono-12")) + + ;; Tree sitter download locations + (setq treesit-language-source-alist + '((c "https://github.com/tree-sitter/tree-sitter-c") + (cpp "https://github.com/tree-sitter/tree-sitter-cpp")))) + +(use-package recentf + :config + (recentf-mode 1)) + +;; evil +(use-package evil + :init + (setq evil-want-integration t + evil-want-keybinding nil + evil-undo-system 'undo-redo + evil-search-module 'isearch) + :config + (evil-mode 1) + (evil-define-key '(normal visual motion) proced-mode-map + "u" #'proced-unmark) + (evil-define-key '(normal visual motion) dired-mode-map + "u" #'dired-unmark)) +(use-package evil-collection + :diminish evil-collection-unimpaired-mode + :config + (evil-collection-init)) +(use-package evil-surround + :config + (global-evil-surround-mode 1)) + +;; which-key +(use-package which-key + :diminish which-key-mode + :config + (which-key-mode 1)) + +;; avy +(use-package avy + :bind ("C-c C-j" . avy-resume) + :init + (define-minor-mode my/evil-avy-mode + "Minor mode to define avy motions for evil" + :global t + :keymap (make-sparse-keymap)) + (evil-define-key '(normal visual operator motion) my/evil-avy-mode-map + "s" #'evil-avy-goto-char-2 + "S" #'evil-avy-goto-line) + (my/evil-avy-mode 1) + :config + (avy-setup-default)) + +;; ace-window +(use-package ace-window + :diminish ace-window-mode + :bind ("M-o" . ace-window) + :init + (setq aw-scope 'frame + aw-minibuffer-flag t)) + +;; savehist +(use-package savehist + :config + (savehist-mode 1)) + +;; vertico +(use-package vertico + :bind (:map vertico-map + ("C-S-k" . kill-line) + ("C-k" . vertico-previous) + ("C-j" . vertico-next)) + :init + (setq vertico-cycle t + enable-recursive-minibuffers t + read-extended-command-predicate #'command-completion-default-include-p + minibuffer-prompt-properties '(read-only t + cursor-intangible t + face minibuffer-prompt)) + (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + (vertico-mode 1)) + +;; orderless +(use-package orderless + :autoload orderless-define-completion-style + :init + (orderless-define-completion-style my/orderless-with-initialism + (orderless-matching-styles '(orderless-initialism + orderless-literal + orderless-regexp))) + (setq completion-styles '(orderless basic) + completion-category-defaults nil + completion-category-overrides '((file + (styles basic partial-completion)) + (command + (my/orderless-with-initialism basic))))) + +;; marginalia +(use-package marginalia + :bind (:map minibuffer-local-map + ("M-a" . marginalia-cycle)) + :init + (marginalia-mode 1)) + +;; embark +(use-package embark + :bind (("M-e" . embark-act) + :map minibuffer-local-map + ("M-E" . embark-collect))) + +;; consult +(use-package consult + :bind (("C-s" . consult-line) + ("C-x b" . consult-buffer) + ("C-S-s" . consult-ripgrep) + ("C-x C-S-f" . consult-fd) + ("C-x C-m" . consult-man) + ("C-h TAB" . consult-info) + ("C-h C-m" . my/consult-emacs-info) + ("C-x c k" . consult-keep-lines) + ("C-x c f" . consult-focus-lines) + ("C-x c r" . consult-recent-file) + ("C-x c b" . consult-bookmark) + :map flymake-mode-map + ("C-c e" . consult-flymake)) + :init + (defun my/consult-emacs-info () + "`consult-info' for emacs specific pages." + (interactive) + (consult-info "emacs" "efaq" "cl" "compat" "elisp")) + (evil-declare-motion #'consult-line)) + +;; integration for embark and consult +(use-package embark-consult + :hook (embark-collect-mode . consult-preview-at-point-mode)) + +;; corfu (autocomplete) +(use-package corfu + :bind ("M-" . corfu-complete) + :init + (setq corfu-cycle t + corfu-auto t + corfu-on-exact-match nil + completion-cycle-threshold 3) + (global-corfu-mode 1)) + +;; xref +(use-package xref + :init + (evil-define-key '(normal motion) 'global + "gr" #'xref-find-references) + (setq xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref)) + +;; flymake +(use-package flymake + :init + (flymake-mode 1)) + +;; eldoc +(use-package eldoc + :diminish eldoc-mode + :init + (set eldoc-echo-area-use-multiline-p nil)) + +(use-package vterm + :bind (:map evil-normal-state-map + ("M-v" . vterm))) + +;; Theme (doom-themes) +(use-package doom-themes + :config + (load-theme 'doom-molokai t) + (doom-themes-org-config)) + +;; solaire-mode +(use-package solaire-mode + :config + (solaire-global-mode 1))