;;; Personal configuration -*- lexical-binding: t -*- ;; Save the contents of this file under ~/.emacs.d/init.el ;; Do not forget to use Emacs' built-in help system: ;; Use C-h C-h to get an overview of all help commands. All you ;; need to know about Emacs (what commands exist, what functions do, ;; what variables specify), the help system can provide. (unless (package-installed-p 'use-package) (require 'package) (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/"))) (package-refresh-contents) (package-install 'use-package)) ;; Ensure package archive melpa is available (require 'package) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) (package-initialize) (package-refresh-contents) ;; Load a custom theme (unless (package-installed-p 'autumn-light-theme) (package-install 'autumn-light-theme)) (load-theme 'autumn-light t) ;; Disable the tool bar (tool-bar-mode -1) ;; Disable splash screen (setq inhibit-startup-screen t) ;;; Completion framework (unless (package-installed-p 'vertico) (package-install 'vertico)) ;; Enable completion by narrowing (vertico-mode t) ;;; Extended completion utilities (unless (package-installed-p 'consult) (package-install 'consult)) (global-set-key [rebind switch-to-buffer] #'consult-buffer) ;; Enable line numbering in `prog-mode' (add-hook 'prog-mode-hook #'display-line-numbers-mode) ;; Automatically pair parentheses (electric-pair-mode t) ;;; LSP Support (unless (package-installed-p 'eglot) (package-install 'eglot)) ;; Enable LSP support by default in programming buffers (add-hook 'prog-mode-hook #'eglot-ensure) ;;; Inline static analysis ;; Enabled inline static analysis (add-hook 'prog-mode-hook #'flymake-mode) ;;; Pop-up completion (unless (package-installed-p 'corfu) (package-install 'corfu)) ;; Enable autocompletion by default in programming buffers (add-hook 'prog-mode-hook #'corfu-mode) ;;; Git client (unless (package-installed-p 'magit) (package-install 'magit)) ;; Bind the `magit-status' command to a convenient key. (global-set-key (kbd "C-c g") #'magit-status) ;;; Indication of local VCS changes (unless (package-installed-p 'diff-hl) (package-install 'diff-hl)) ;; Enable `diff-hl' support by default in programming buffers (add-hook 'prog-mode-hook #'diff-hl-mode) ;;; Ada Support (unless (package-installed-p 'ada-mode) (package-install 'ada-mode)) ;;; Lua Support (unless (package-installed-p 'lua-mode) (package-install 'lua-mode)) ;;; NASM Support (unless (package-installed-p 'nasm-mode) (package-install 'nasm-mode)) ;;; Rust Support (unless (package-installed-p 'rust-mode) (package-install 'rust-mode)) ;;; LaTeX support (unless (package-installed-p 'auctex) (package-install 'auctex)) (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil) ;; Enable LaTeX math support (add-hook 'LaTeX-mode-hook #'LaTeX-math-mode) ;; Enable reference mangment (add-hook 'LaTeX-mode-hook #'reftex-mode) ;;; Markdown support (unless (package-installed-p 'markdown-mode) (package-install 'markdown-mode)) ;;; Outline-based notes management and organizer ;;; EditorConfig support (unless (package-installed-p 'editorconfig) (package-install 'editorconfig)) ;; Enable EditorConfig (editorconfig-mode t) ;;; Vim Emulation (unless (package-installed-p 'evil) (package-install 'evil)) ;; Enable Vim emulation (evil-mode t) ;; Enable Vim emulation in programming buffers (add-hook 'prog-mode-hook #'evil-local-mode) ;; Miscellaneous options (setq-default major-mode (lambda () ; guess major mode from file name (unless buffer-file-name (let ((buffer-file-name (buffer-name))) (set-auto-mode))))) (setq confirm-kill-emacs #'yes-or-no-p) (setq window-resize-pixelwise t) (setq frame-resize-pixelwise t) (save-place-mode t) (savehist-mode t) (recentf-mode t) (defalias 'yes-or-no #'y-or-n-p) ;; Store automatic customisation options elsewhere (setq custom-file (locate-user-emacs-file "custom.el")) (when (file-exists-p custom-file) (load custom-file))