Generate emacs config.

https://emacs.amodernist.com/
This commit is contained in:
Gabriel Ebner 2022-06-24 21:25:37 +02:00
parent 1a4af815b2
commit c95692bd90

106
emacs.d/init.el Normal file

@ -0,0 +1,106 @@
;;; 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.
;; Set default font face
(set-face-attribute 'default nil :font "Fira Mono")
;; Disable the menu bar
(menu-bar-mode -1)
;; Disable the tool bar
(tool-bar-mode -1)
;; Disable the scroll bars
(scroll-bar-mode -1)
;;; Completion framework
(unless (package-installed-p 'vertico)
(package-install '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
(unless (package-installed-p 'consult)
(package-install 'consult))
(global-set-key [rebind switch-to-buffer] #'consult-buffer)
;;; 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)
;;; Pop-up auto-completion
(unless (package-installed-p 'company)
(package-install 'company))
;; Enable Company by default in programming buffers
(add-hook 'prog-mode-hook #'company-mode)
;;; 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)
;;; 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)
;;; Markdown support
(unless (package-installed-p 'markdown-mode)
(package-install 'markdown-mode))
;;; 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)
;; 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))