diff --git a/config.org.old b/config.org.old deleted file mode 100644 index e138aa6..0000000 --- a/config.org.old +++ /dev/null @@ -1,383 +0,0 @@ -#+TITLE: My Emacs Configuration -#+AUTHOR: Tom Berg -#+OPTIONS: num:nil -* Lecical Binding -#+BEGIN_SRC emacs-lisp - ;;; ... -*- lexical-binding: nil -*- -#+END_SRC -* Package -#+BEGIN_SRC emacs-lisp - ;; Initialize package sources - (require 'package) - - (setq package-archives '(("melpa" . "https://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/") - ("elpa" . "https://elpa.gnu.org/packages/"))) - - (unless package-archive-contents - (package-refresh-contents)) - - ;; Bootstrap use-package - (unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) - (require 'use-package) - (setq use-package-always-ensure t) -#+END_SRC -* UI -** Clean up -#+BEGIN_SRC emacs-lisp - (setq inhibit-startup-message t) - - (scroll-bar-mode -1) ; Disable visible scrollbar - (tool-bar-mode -1) ; Disable the toolbar - (tooltip-mode -1) ; Disable tooltips - (set-fringe-mode 10) ; Give some breathing room - - (menu-bar-mode -1) ; Disable the menu bar - - (set-face-attribute 'default nil :font "MesloLGS NF" :height 140) -#+END_SRC -** Theme -#+BEGIN_SRC emacs-lisp - (use-package doom-themes - :config - ;; Best dark themes for focus: - ;; doom-one, doom-dracula, doom-tokyo-night, doom-palenight - (load-theme 'doom-tokyo-night t) - - ;; Enable flashing mode-line on errors - (doom-themes-visual-bell-config) - - ;; Corrects org-mode's native fontification - (doom-themes-org-config)) - -;; OR Alternative: Modus themes (high contrast, accessibility focused) -;; (use-package modus-themes -;; :config -;; (load-theme 'modus-vivendi t)) ; Dark theme - -;; All-the-icons for visual indicators -(use-package all-the-icons - :if (display-graphic-p)) - #+END_SRC -** Help -#+BEGIN_SRC emacs-lisp - (which-key-mode) - (use-package helpful - :ensure t ; Install from MELPA if not already present - :bind - ;; Replace default help commands with Helpful equivalents - (("C-h f" . helpful-callable) ; Functions, macros, and special forms - ("C-h v" . helpful-variable) ; Variables - ("C-h k" . helpful-key) ; Keybindings - ("C-h x" . helpful-command) ; Commands only - ("C-h ." . helpful-at-point)) ; Symbol at point - ) -#+END_SRC -* Evil Mode -#+BEGIN_SRC emacs-lisp - ;; Evil setup - (use-package evil - :ensure t - :init - (setq evil-want-integration t) - (setq evil-want-keybinding nil) - :config - (evil-mode 1)) - - ;; Evil Collection setup - (use-package evil-collection - :after evil - :ensure t - :config - (evil-collection-init)) -#+END_SRC -* Progaming -** UI -#+BEGIN_SRC emacs-lisp - (column-number-mode) - (add-hook 'prog-mode-hook 'display-line-numbers-mode) - (use-package rainbow-delimiters - :hook (prog-mode . rainbow-delimiters-mode) - ) -#+END_SRC -** Magit -#+BEGIN_SRC emacs-lisp - (use-package magit - :commands (magit-status magit-get-current-branch) - :custom - (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) -#+END_SRC - -** Format -#+BEGIN_SRC emacs-lisp - (use-package format-all - :commands format-all-mode - :hook (prog-mode . format-all-mode) - :config - (setq-default format-all-formatters - '(("C" (astyle "--mode=c")) - ("Shell" (shfmt "-i" "4" "-ci"))))) -#+END_SRC -** treesit -#+BEGIN_SRC emacs-lisp - (use-package treesit-auto - :custom - (treesit-auto-install 'prompt) - :config - (treesit-auto-add-to-auto-mode-alist 'all) - (delete 'rust treesit-auto-langs) - (global-treesit-auto-mode)) - -#+END_SRC -** direnv -#+BEGIN_SRC emacs-lisp - (use-package direnv - :config - (direnv-mode)) -#+END_SRC -** Rust -#+BEGIN_SRC emacs-lisp - (use-package rust-mode - :init - (setq rust-mode-treesitter-derive t) - :config - (add-hook 'rust-mode-hook 'eglot-ensure) - (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))) -#+END_SRC -** Haskell -#+BEGIN_SRC emacs-lisp - (use-package haskell-mode - :config - (add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-mode)) - (add-hook 'haskell-mode-hook 'eglot-ensure)) -#+END_SRC -** Nix -#+BEGIN_SRC emacs-lisp - (add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-ts-mode)) -#+END_SRC - -* Org -** Set up -#+BEGIN_SRC emacs-lisp - (defun dw/org-mode-setup () - (org-indent-mode) - (variable-pitch-mode 1) - (auto-fill-mode 0) - (visual-line-mode 1) - (setq evil-auto-indent nil)) - - (use-package org - :hook (org-mode . dw/org-mode-setup) - :config - (setq org-ellipsis " ▾" - org-hide-emphasis-markers t)) -#+END_SRC - -** Roam -#+BEGIN_SRC emacs-lisp - -#+END_SRC -* Completion Stack -** Marginalia -#+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 - ;; available in the *Completions* buffer, add it to the - ;; `completion-list-mode-map'. - :bind (:map minibuffer-local-map - ("M-A" . marginalia-cycle)) - - ;; The :init section is always executed. - :init - - ;; Marginalia must be activated in the :init section of use-package such that - ;; the mode gets enabled right away. Note that this forces loading the - ;; package. - (marginalia-mode)) -#+END_SRC -** Orderless -#+BEGIN_SRC emacs-lisp - (use-package orderless - :ensure t - :custom - (completion-styles '(orderless basic)) - (completion-category-defaults nil) - (completion-category-overrides '((file (styles basic partial-completion))))) -#+END_SRC -** Vestico -#+BEGIN_SRC emacs-lisp - ;; Enable Vertico. - (use-package vertico - ;;: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)) - - ;; Persist history over Emacs restarts. Vertico sorts by history position. - (use-package savehist - :init - (savehist-mode)) - - ;; Emacs minibuffer configurations. - (use-package emacs - :custom - ;; Support opening new minibuffers from inside existing minibuffers. - (enable-recursive-minibuffers t) - ;; 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. - (read-extended-command-predicate #'command-completion-default-include-p) - ;; Do not allow the cursor in the minibuffer prompt - (minibuffer-prompt-properties - '(read-only t cursor-intangible t face minibuffer-prompt))) -#+END_SRC -** Embark -#+BEGIN_SRC emacs-lisp - (use-package embark - :ensure t - - :bind - (("C-." . embark-act) ;; pick some comfortable binding - ("C-;" . embark-dwim) ;; good alternative: M-. - ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings' - - :init - - ;; Optionally replace the key help with a completing-read interface - (setq prefix-help-command #'embark-prefix-help-command) - - ;; Show the Embark target at point via Eldoc. You may adjust the - ;; Eldoc strategy, if you want to see the documentation from - ;; multiple providers. Beware that using this can be a little - ;; jarring since the message shown in the minibuffer can be more - ;; than one line, causing the modeline to move up and down: - - ;; (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target) - ;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly) - - :config - - ;; Hide the mode line of the Embark live/completions buffers - (add-to-list 'display-buffer-alist - '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" - nil - (window-parameters (mode-line-format . none))))) - - ;; Consult users will also want the embark-consult package. - (use-package embark-consult - :ensure t ; only need to install it, embark loads it after consult if found - :hook - (embark-collect-mode . consult-preview-at-point-mode)) -#+END_SRC -** Consult -#+BEGIN_SRC emacs-lisp - ;; configuration for Consult - (use-package consult - ;; Replace bindings. Lazily loaded by `use-package'. - :bind (;; C-c bindings in `mode-specific-map' - ("C-c M-x" . consult-mode-command) - ("C-c h" . consult-history) - ("C-c k" . consult-kmacro) - ("C-c m" . consult-man) - ("C-c i" . consult-info) - ([remap Info-search] . consult-info) - ;; C-x bindings in `ctl-x-map' - ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command - ("C-x b" . consult-buffer) ;; orig. switch-to-buffer - ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window - ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame - ("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab - ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump - ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer - ;; Custom M-# bindings for fast register access - ("M-#" . consult-register-load) - ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) - ("C-M-#" . consult-register) - ;; 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 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 - ("M-g m" . consult-mark) - ("M-g k" . consult-global-mark) - ("M-g i" . consult-imenu) - ("M-g I" . consult-imenu-multi) - ;; M-s bindings in `search-map' - ("M-s d" . consult-find) ;; Alternative: consult-fd - ("M-s c" . consult-locate) - ("M-s g" . consult-grep) - ("M-s G" . consult-git-grep) - ("M-s r" . consult-ripgrep) - ("M-s l" . consult-line) - ("M-s L" . consult-line-multi) - ("M-s k" . consult-keep-lines) - ("M-s u" . consult-focus-lines) - ;; Isearch integration - ("M-s e" . consult-isearch-history) - :map isearch-mode-map - ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string - ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string - ("M-s l" . consult-line) ;; needed by consult-line to detect isearch - ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch - ;; Minibuffer history - :map minibuffer-local-map - ("M-s" . consult-history) ;; orig. next-matching-history-element - ("M-r" . consult-history)) ;; orig. previous-matching-history-element - - ;; Enable automatic preview at point in the *Completions* buffer. This is - ;; relevant when you use the default completion UI. - :hook (completion-list-mode . consult-preview-at-point-mode) - - ;; The :init configuration is always executed (Not lazy) - :init - - ;; Tweak the register preview for `consult-register-load', - ;; `consult-register-store' and the built-in commands. This improves the - ;; register formatting, adds thin separator lines, register sorting and hides - ;; the window mode line. - (advice-add #'register-preview :override #'consult-register-window) - (setq register-preview-delay 0.5) - - ;; Use Consult to select xref locations with preview - (setq xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref) - - ;; Configure other variables and modes in the :config section, - ;; after lazily loading the package. - :config - - ;; Optionally configure preview. The default value - ;; is 'any, such that any key triggers the preview. - ;; (setq consult-preview-key 'any) - ;; (setq consult-preview-key "M-.") - ;; (setq consult-preview-key '("S-" "S-")) - ;; For some commands and buffer sources it is useful to configure the - ;; :preview-key on a per-command basis using the `consult-customize' macro. - (consult-customize - consult-theme :preview-key '(:debounce 0.2 any) - consult-ripgrep consult-git-grep consult-grep consult-man - consult-bookmark consult-recent-file consult-xref - consult--source-bookmark consult--source-file-register - consult--source-recent-file consult--source-project-recent-file - ;; :preview-key "M-." - :preview-key '(:debounce 0.4 any)) - - ;; Optionally configure the narrowing key. - ;; Both < and C-+ work reasonably well. - (setq consult-narrow-key "<") ;; "C-+" - - ;; Optionally make narrowing help available in the minibuffer. - ;; You may want to use `embark-prefix-help-command' or which-key instead. - ;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") #'consult-narrow-help) - ) -#+END_SRC -