;;; init.el --- my Emacs init ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Initialise package system. (require 'package) (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/"))) (package-initialize) ;; Run this manually from time to time to update package lists. ;(package-refresh-contents) ;; Use-package for civilized configuration (unless (package-installed-p 'use-package) (package-install 'use-package)) (require 'use-package) (setq use-package-always-ensure t) ;; Put customization in its own file. (setq custom-file "~/.emacs.d/custom.el") (load custom-file) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Packages I like. (use-package apache-mode) (use-package blacken) (use-package diminish) (use-package go-mode) (use-package graphviz-dot-mode) (use-package magit :config (global-set-key (kbd "C-x g") 'magit-status)) (use-package python-mode :config (add-hook 'python-mode-hook 'blacken-mode)) (use-package yaml-mode :config (add-to-list 'auto-mode-alist '("\\.ick\\'" . yaml-mode)) (add-to-list 'auto-mode-alist '("\\.vmdb\\'" . yaml-mode)) (add-to-list 'auto-mode-alist '("\\.yaml\\'" . yaml-mode)) (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))) (use-package markdown-mode :config (add-to-list 'auto-mode-alist '("NEWS" . markdown-mode)) (add-to-list 'auto-mode-alist '("README" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.mdwn\\'" . markdown-mode))) (use-package modus-operandi-theme :config (setq modus-operandi-theme-slanted-constructs t) (setq modus-operandi-theme-bold-constructs t) (load-theme 'modus-operandi t)) (use-package rust-mode :config (setq rust-format-on-save t)) (use-package flycheck :config (setq-default flycheck-disabled-checkers '(python-pylint))) (use-package flycheck-rust) ;;(with-eval-after-load 'rust-mode ;; (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)) (use-package flycheck-color-mode-line) (eval-after-load 'flycheck '(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; UI tweaks. ;; Don't show help at startup (setq inhibit-startup-screen t) ;; Disable tool bar in windows. (tool-bar-mode 0) ;; Show column numbers in the mode line. (column-number-mode t) (setq column-number-indicator-zero-based nil) ;; Show line number before line. (global-display-line-numbers-mode) (set-face-attribute 'line-number nil :height 0.7) (set-face-attribute 'line-number-current-line nil :foreground "#ff0000" :height 0.7) ;; Enable X CLIPBOARD selection, instead of PRIMARY. (setq select-enable-clipboard t) ;; Show directories in the Buffers menu. (setq buffers-menu-show-directories t) ;; Don't line wrap long lines. (set-default 'truncate-lines t) ;; Show size in mode line. (size-indication-mode) ;; Highlight current line. (add-hook 'text-mode-hook 'hl-line-mode) (add-hook 'prog-mode-hook 'hl-line-mode) (when (display-graphic-p) (global-unset-key "\C-x\C-c") (global-unset-key "\C-z") (global-unset-key "\C-_") (global-unset-key (kbd "\C-x\C-z")) (global-unset-key (kbd "")) (global-set-key (kbd "C-=") 'text-scale-adjust) (global-set-key (kbd "C-+") 'text-scale-adjust) (global-set-key (kbd "C--") 'text-scale-adjust) (global-set-key (kbd "C-0") 'text-scale-adjust) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Other tweaks. ;; Do not make backup files when saving. (setq make-backup-files nil) ;; Turn on auto-fill-mode in all text modes automatically. (setq text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify))) ;; Don't require double spaces to end sentences. (setq sentence-end-double-space nil) ;; Base font size. (set-face-attribute 'default nil :height 130 :family "Hack") ;; Turn on flyspell spell checking. (require 'flyspell) (add-hook 'text-mode-hook 'flyspell-mode) (add-hook 'prog-mode-hook 'flyspell-prog-mode) (set-face-attribute 'flyspell-incorrect nil :foreground "#ff0000") ;; Turn on flycheck mode for program code. (add-hook 'prog-mode-hook 'flycheck-mode) (set-face-attribute 'flycheck-error nil :weight 'bold :underline "#ff0000" :foreground "#ff0000") ;;(require 'flymake) ;;(add-hook 'prog-mode-hook 'flymake-mode) ;;(add-hook 'prog-mode-hook 'flymake-mode) ;;(set-face-attribute 'flymake-error nil ;; :underline "#ff0000" ;; :foreground "#ff0000") ;; Show current function. (add-hook 'prog-mode-hook 'which-function-mode) ;; Show matching parens. (add-hook 'text-mode-hook 'show-paren-mode) (add-hook 'prog-mode-hook 'show-paren-mode)