Created
January 1, 2019 17:44
-
-
Save Jomik/dde94da78b488c8a7fe990a74cd4dfd2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;; init.el --- Emacs configuration à la Home Manager. | |
| ;; | |
| ;; -*- lexical-binding: t; -*- | |
| ;; | |
| ;;; Commentary: | |
| ;; | |
| ;; A configuration generated from a Nix based configuration by | |
| ;; Home Manager. | |
| ;; | |
| ;;; Code: | |
| ;; Remember when configuration started. See bottom for rest of this. | |
| ;; Idea taken from http://writequit.org/org/settings.html. | |
| (defconst emacs-start-time (current-time)) | |
| (defun hm/reduce-gc () | |
| "Reduce the frequency of garbage collection." | |
| (setq gc-cons-threshold 402653184 | |
| gc-cons-percentage 0.6)) | |
| (defun hm/restore-gc () | |
| "Restore the frequency of garbage collection." | |
| (setq gc-cons-threshold 16777216 | |
| gc-cons-percentage 0.1)) | |
| ;; Make GC more rare during init and while minibuffer is active. | |
| (eval-and-compile #'hm/reduce-gc) | |
| (add-hook 'minibuffer-setup-hook #'hm/reduce-gc) | |
| ;; But make it more regular after startup and after closing minibuffer. | |
| (add-hook 'emacs-startup-hook #'hm/restore-gc) | |
| (add-hook 'minibuffer-exit-hook #'hm/restore-gc) | |
| ;; Avoid unnecessary regexp matching while loading .el files. | |
| (defvar hm/file-name-handler-alist file-name-handler-alist) | |
| (setq file-name-handler-alist nil) | |
| (defun hm/restore-file-name-handler-alist () | |
| "Restores the file-name-handler-alist variable." | |
| (setq file-name-handler-alist hm/file-name-handler-alist) | |
| (makunbound 'hm/file-name-handler-alist)) | |
| (add-hook 'emacs-startup-hook #'hm/restore-file-name-handler-alist) | |
| (eval-when-compile | |
| (require 'package) | |
| (setq package-archives nil | |
| package-enable-at-startup nil | |
| package--init-file-ensured t) | |
| (require 'use-package) | |
| ;; To help fixing issues during startup. | |
| (setq use-package-verbose nil)) | |
| ;; For :diminish in (use-package). | |
| (require 'diminish) | |
| (use-package counsel | |
| :general | |
| ("M-x" 'counsel-M-x) | |
| ) | |
| (use-package evil | |
| :config | |
| (evil-mode 1) | |
| :init | |
| (setq evil-want-integration t) | |
| (setq evil-want-keybinding nil) | |
| ) | |
| (use-package evil-collection | |
| :after (evil) | |
| :config | |
| (evil-collection-init)) | |
| (use-package general | |
| :config | |
| (general-evil-setup t)) | |
| (use-package ivy | |
| :diminish () | |
| :config | |
| (ivy-mode 1) | |
| :init | |
| (setq ivy-height 15)) | |
| (use-package swiper | |
| :general | |
| ("C-s" 'swiper) | |
| ) | |
| (use-package systemd | |
| :defer t) | |
| ;; Make a note of how long the configuration part of the start took. | |
| (let ((elapsed (float-time (time-subtract (current-time) | |
| emacs-start-time)))) | |
| (message "Loading settings...done (%.3fs)" elapsed)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment