2022-06-24 19:25:37 +00:00
|
|
|
;;; 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.
|
|
|
|
|
2022-06-24 20:26:04 +00:00
|
|
|
;; Add the NonGNU ELPA package archive
|
|
|
|
(require 'package)
|
|
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
|
|
|
(add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/"))
|
|
|
|
|
|
|
|
;; Disable splash screen
|
|
|
|
(setq inhibit-startup-screen t)
|
|
|
|
|
|
|
|
;; Disable satanic torture
|
|
|
|
(blink-cursor-mode 0)
|
|
|
|
|
2022-06-24 19:25:37 +00:00
|
|
|
;; Set default font face
|
2022-06-24 20:26:04 +00:00
|
|
|
(set-face-attribute 'default nil :font "Fira Mono" :height 125)
|
2022-06-24 19:25:37 +00:00
|
|
|
|
|
|
|
;; Disable the menu bar
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
|
|
|
|
;; Disable the tool bar
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
|
|
|
|
;; Disable the scroll bars
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
|
2022-06-27 07:12:12 +00:00
|
|
|
;; Disable eldoc
|
|
|
|
(global-eldoc-mode -1)
|
|
|
|
(setq lsp-eldoc-enable-hover nil)
|
|
|
|
|
2022-06-24 20:26:04 +00:00
|
|
|
(defun install-package-if-missing (pkg)
|
|
|
|
(unless (package-installed-p pkg)
|
|
|
|
(package-install pkg)))
|
|
|
|
|
2022-06-24 19:25:37 +00:00
|
|
|
;;; Completion framework
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'vertico)
|
2022-06-24 19:25:37 +00:00
|
|
|
|
|
|
|
;; Enable completion by narrowing
|
|
|
|
(vertico-mode t)
|
|
|
|
|
|
|
|
;; Improve directory navigation
|
|
|
|
(with-eval-after-load 'vertico
|
|
|
|
(define-key vertico-map (kbd "RET") #'vertico-directory-enter)
|
|
|
|
(define-key vertico-map (kbd "DEL") #'vertico-directory-delete-word)
|
|
|
|
(define-key vertico-map (kbd "M-d") #'vertico-directory-delete-char))
|
|
|
|
|
|
|
|
;;; Extended completion utilities
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'consult)
|
2022-06-24 19:25:37 +00:00
|
|
|
(global-set-key [rebind switch-to-buffer] #'consult-buffer)
|
|
|
|
|
|
|
|
;;; LSP Support
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'lsp-mode)
|
2022-06-24 19:25:37 +00:00
|
|
|
|
|
|
|
;;; Pop-up auto-completion
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'company)
|
2022-06-24 19:25:37 +00:00
|
|
|
|
|
|
|
;; Enable Company by default in programming buffers
|
|
|
|
(add-hook 'prog-mode-hook #'company-mode)
|
|
|
|
|
|
|
|
;;; Indication of local VCS changes
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'diff-hl)
|
2022-06-24 19:25:37 +00:00
|
|
|
|
|
|
|
;; Enable `diff-hl' support by default in programming buffers
|
|
|
|
(add-hook 'prog-mode-hook #'diff-hl-mode)
|
|
|
|
|
2022-06-24 20:26:04 +00:00
|
|
|
;;; Lean Support
|
|
|
|
(let ((path "~/lean4-mode"))
|
|
|
|
(when (file-exists-p path)
|
|
|
|
(setq load-path (cons path load-path))
|
|
|
|
(dolist (p '(dash f flycheck lsp-mode magit-section s))
|
|
|
|
(install-package-if-missing p))
|
|
|
|
(require 'lean4-mode)))
|
|
|
|
(setq lean4-highlight-inaccessible-names nil)
|
|
|
|
|
2022-06-24 19:25:37 +00:00
|
|
|
;;; Rust Support
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'rust-mode)
|
2022-06-24 19:25:37 +00:00
|
|
|
|
|
|
|
;;; LaTeX support
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'auctex)
|
2022-06-24 19:25:37 +00:00
|
|
|
(setq TeX-auto-save t)
|
|
|
|
(setq TeX-parse-self t)
|
|
|
|
(setq-default TeX-master nil)
|
|
|
|
|
|
|
|
;;; Markdown support
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'markdown-mode)
|
2022-06-24 19:25:37 +00:00
|
|
|
|
|
|
|
;;; EditorConfig support
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'editorconfig)
|
2022-06-24 19:25:37 +00:00
|
|
|
(editorconfig-mode t)
|
|
|
|
|
|
|
|
;;; Vim Emulation
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'evil)
|
2022-06-24 19:25:37 +00:00
|
|
|
(evil-mode t)
|
2022-06-24 20:26:04 +00:00
|
|
|
(install-package-if-missing 'evil-commentary)
|
|
|
|
(evil-commentary-mode)
|
|
|
|
|
2023-03-31 03:38:05 +00:00
|
|
|
;; Helm
|
|
|
|
(install-package-if-missing 'helm)
|
|
|
|
(install-package-if-missing 'helm-projectile)
|
|
|
|
(install-package-if-missing 'helm-rg)
|
|
|
|
(global-set-key (kbd "M-x") #'helm-M-x)
|
|
|
|
(global-set-key (kbd "C-x C-f") #'helm-find-files)
|
|
|
|
(global-set-key (kbd "C-x C-b") #'helm-buffers-list)
|
|
|
|
(evil-define-key '(visual normal) 'global
|
|
|
|
(kbd "SPC f g") 'helm-projectile-rg
|
|
|
|
(kbd "C-p") 'helm-projectile-find-file)
|
|
|
|
(define-key helm-map (kbd "<left>") 'backward-char)
|
|
|
|
(define-key helm-map (kbd "<right>") 'forward-char)
|
|
|
|
|
2022-06-24 20:26:04 +00:00
|
|
|
;;; Color Themes
|
|
|
|
(install-package-if-missing 'color-theme-sanityinc-tomorrow)
|
|
|
|
(load-theme 'sanityinc-tomorrow-bright t)
|
2022-06-24 19:25:37 +00:00
|
|
|
|
|
|
|
;; 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))
|