137 lines
3.9 KiB
EmacsLisp
137 lines
3.9 KiB
EmacsLisp
;;; 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.
|
|
|
|
;; 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)
|
|
|
|
;; Set default font face
|
|
(set-face-attribute 'default nil :font "Fira Mono" :height 125)
|
|
|
|
;; Disable the menu bar
|
|
(menu-bar-mode -1)
|
|
|
|
;; Disable the tool bar
|
|
(tool-bar-mode -1)
|
|
|
|
;; Disable the scroll bars
|
|
(scroll-bar-mode -1)
|
|
|
|
;; Disable eldoc
|
|
(global-eldoc-mode -1)
|
|
(setq lsp-eldoc-enable-hover nil)
|
|
|
|
(defun install-package-if-missing (pkg)
|
|
(unless (package-installed-p pkg)
|
|
(package-install pkg)))
|
|
|
|
;;; Completion framework
|
|
(install-package-if-missing 'vertico)
|
|
|
|
;; 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
|
|
(install-package-if-missing 'consult)
|
|
(global-set-key [rebind switch-to-buffer] #'consult-buffer)
|
|
|
|
;;; LSP Support
|
|
(install-package-if-missing 'lsp-mode)
|
|
|
|
;;; Pop-up auto-completion
|
|
(install-package-if-missing 'company)
|
|
|
|
;; Enable Company by default in programming buffers
|
|
(add-hook 'prog-mode-hook #'company-mode)
|
|
|
|
;;; Indication of local VCS changes
|
|
(install-package-if-missing 'diff-hl)
|
|
|
|
;; Enable `diff-hl' support by default in programming buffers
|
|
(add-hook 'prog-mode-hook #'diff-hl-mode)
|
|
|
|
;;; 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)
|
|
|
|
;;; Rust Support
|
|
(install-package-if-missing 'rust-mode)
|
|
|
|
;;; LaTeX support
|
|
(install-package-if-missing 'auctex)
|
|
(setq TeX-auto-save t)
|
|
(setq TeX-parse-self t)
|
|
(setq-default TeX-master nil)
|
|
|
|
;;; Markdown support
|
|
(install-package-if-missing 'markdown-mode)
|
|
|
|
;;; EditorConfig support
|
|
(install-package-if-missing 'editorconfig)
|
|
(editorconfig-mode t)
|
|
|
|
;;; Vim Emulation
|
|
(install-package-if-missing 'evil)
|
|
(evil-mode t)
|
|
(install-package-if-missing 'evil-commentary)
|
|
(evil-commentary-mode)
|
|
|
|
;; 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)
|
|
|
|
;;; Color Themes
|
|
(install-package-if-missing 'color-theme-sanityinc-tomorrow)
|
|
(load-theme 'sanityinc-tomorrow-bright t)
|
|
|
|
;; 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))
|