This commit is contained in:
2019-07-15 21:25:42 +02:00
parent 8d5bf7d4c5
commit cead30f787
2 changed files with 723 additions and 877 deletions

168
init.el
View File

@@ -84,11 +84,6 @@
(use-package minions (use-package minions
:config (minions-mode 1)) :config (minions-mode 1))
;;
(use-package undo-tree
:init
global-undo-tree-mode)
;; UTF-8 everywhere, please. ;; UTF-8 everywhere, please.
(prefer-coding-system 'utf-8) (prefer-coding-system 'utf-8)
@@ -104,12 +99,10 @@
(load custom-file 'noerror) (load custom-file 'noerror)
;; Always prefer newer files. ;; Always prefer newer files.
(setq load-prefer-newer t) (setq load-prefer-newer t)
;; Disable otiose GUI settings: they just waste space. ;; Disable otiose GUI settings: they just waste space.
;; fringe-mode is especially ruinous performance-wise. ;; fringe-mode is especially ruinous performance-wise.
(when (window-system) (when (window-system)
(tool-bar-mode -1) (tool-bar-mode -1)
(scroll-bar-mode -1) (scroll-bar-mode -1)
@@ -129,7 +122,6 @@
;; probably just come with the main distribution. ;; probably just come with the main distribution.
;; Recentf comes with Emacs but it should always be enabled. ;; Recentf comes with Emacs but it should always be enabled.
(use-package recentf (use-package recentf
:init (recentf-mode t) :init (recentf-mode t)
:config :config
@@ -139,7 +131,6 @@
;; Ivy makes most minibuffer prompts sortable and filterable. I used ;; Ivy makes most minibuffer prompts sortable and filterable. I used
;; to use helm, but it was too slow. Unfortunately org-ref depends on ;; to use helm, but it was too slow. Unfortunately org-ref depends on
;; it, but I never load it, so we good. ;; it, but I never load it, so we good.
(use-package ivy (use-package ivy
:ensure t :ensure t
:init :init
@@ -158,7 +149,6 @@
:diminish) :diminish)
;; ivy-rich makes Ivy look a little bit more like Helm. ;; ivy-rich makes Ivy look a little bit more like Helm.
(use-package ivy-rich (use-package ivy-rich
:after counsel :after counsel
:custom :custom
@@ -171,7 +161,6 @@
(use-package ivy-hydra) (use-package ivy-hydra)
;; Slurp environment variables from the shell. ;; Slurp environment variables from the shell.
(use-package exec-path-from-shell (use-package exec-path-from-shell
:config :config
(exec-path-from-shell-initialize)) (exec-path-from-shell-initialize))
@@ -182,7 +171,6 @@
;; Counsel applies Ivy-like behavior to other builtin features of ;; Counsel applies Ivy-like behavior to other builtin features of
;; emacs, e.g. search. ;; emacs, e.g. search.
(use-package counsel (use-package counsel
:ensure t :ensure t
:after ivy :after ivy
@@ -200,13 +188,11 @@
:diminish) :diminish)
;; Deadgrep is amazing. ;; Deadgrep is amazing.
(use-package deadgrep (use-package deadgrep
:bind (("C-c h" . deadgrep))) :bind (("C-c h" . deadgrep)))
;; projectile comes with Emacs these days, but we want to enable ;; projectile comes with Emacs these days, but we want to enable
;; caching, since I work on big projects. ;; caching, since I work on big projects.
(use-package projectile (use-package projectile
:bind (("C-c f" . projectile-find-file)) :bind (("C-c f" . projectile-find-file))
:config :config
@@ -215,32 +201,27 @@
:diminish) :diminish)
;; Counsel and projectile should work together. ;; Counsel and projectile should work together.
(use-package counsel-projectile (use-package counsel-projectile
:bind (("C-c f" . counsel-projectile)) :bind (("C-c f" . counsel-projectile))
:init :init
(counsel-projectile-mode)) (counsel-projectile-mode))
;; Sort commands by recency in ivy windows. ;; Sort commands by recency in ivy windows.
(use-package smex) (use-package smex)
;; Keychain stuff. Note to self: if you keep having to enter your ;; Keychain stuff. Note to self: if you keep having to enter your
;; keychain password on OS X, make sure that you have the following in .ssh/config: ;; keychain password on OS X, make sure that you have the following in .ssh/config:
;; Host * ;; Host *
;; UseKeychain yes ;; UseKeychain yes
(use-package keychain-environment (use-package keychain-environment
:config :config
(keychain-refresh-environment)) (keychain-refresh-environment))
;; Elm stuff. ;; Elm stuff.
(use-package elm-mode (use-package elm-mode
:disabled) :disabled)
;; Company is the best Emacs completion system. ;; Company is the best Emacs completion system.
(use-package company (use-package company
:bind (("C-." . company-complete)) :bind (("C-." . company-complete))
:diminish company-mode :diminish company-mode
@@ -284,13 +265,11 @@
(add-to-list 'magit-no-confirm 'stage-all-changes)) (add-to-list 'magit-no-confirm 'stage-all-changes))
;; Unclear whether this does anything at the moment. ;; Unclear whether this does anything at the moment.
(use-package libgit (use-package libgit
:disabled :disabled
:after magit) :after magit)
;; Since I grew up on Textmate, I'm more-or-less reliant on snippets. ;; Since I grew up on Textmate, I'm more-or-less reliant on snippets
(use-package yasnippet (use-package yasnippet
:config :config
(yas-global-mode 1) (yas-global-mode 1)
@@ -298,33 +277,24 @@
:diminish yas-minor-mode) :diminish yas-minor-mode)
;; I usually don't edit very large files, but saveplace is nice on the occasions I do. ;; I usually don't edit very large files, but saveplace is nice on the occasions I do.
(use-package saveplace (use-package saveplace
:disabled :disabled
:config (setq-default save-place t)) :config (setq-default save-place t))
;; Haskell and Elisp are made a lot easier when delimiters are nicely color-coded. ;; Haskell and Elisp are made a lot easier when delimiters are nicely color-coded.
(use-package rainbow-delimiters (use-package rainbow-delimiters
:disabled :disabled
:hook (prog-mode . rainbow-delimiters-mode)) :hook (prog-mode . rainbow-delimiters-mode))
;; multiple-cursors is better than cua-selection-mode. ;; multiple-cursors is better than cua-selection-mode.
;; TODO: learn ace-mc ;; TODO: learn ace-mc
(use-package multiple-cursors (use-package multiple-cursors
:bind (("C-c M" . mc/edit-lines))) :bind (("C-c M" . mc/edit-lines)))
;; Common Haskell snippets. These take a while to load, so no need to block on startup.
(use-package haskell-snippets
:defer yasnippet)
;; The beauty of undo-tree is that it means that, once you've typed something into ;; The beauty of undo-tree is that it means that, once you've typed something into
;; a buffer, you'll always be able to get it back. That is crucial. ;; a buffer, you'll always be able to get it back. That is crucial.
(use-package undo-tree (use-package undo-tree
:bind (("C-c _" . undo-tree-visualize)) :bind (("C-x u" . undo-tree-visualize))
:config :config
(global-undo-tree-mode +1) (global-undo-tree-mode +1)
(unbind-key "M-_" undo-tree-map) (unbind-key "M-_" undo-tree-map)
@@ -332,7 +302,6 @@
;; Trying undo-propose, which seems to offer a better experience, as ;; Trying undo-propose, which seems to offer a better experience, as
;; undo tree is prone to losing data. ;; undo tree is prone to losing data.
(use-package undo-propose (use-package undo-propose
:disabled :disabled
:bind (("C-c _" . undo-propose) :bind (("C-c _" . undo-propose)
@@ -344,12 +313,10 @@
;; (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)) ;; (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on))
;; C stuff. ;; C stuff.
(use-package cc-mode (use-package cc-mode
:disabled) :disabled)
;; I do all of my writing in either org-mode or markdown-mode. ;; I do all of my writing in either org-mode or markdown-mode.
(use-package markdown-mode (use-package markdown-mode
:mode ("\\.md$" . gfm-mode) :mode ("\\.md$" . gfm-mode)
:config :config
@@ -364,18 +331,13 @@
("C-c l w" . avy-goto-word-1) ("C-c l w" . avy-goto-word-1)
("C-'" . ivy-avy))) ("C-'" . ivy-avy)))
(use-package yaml-mode
:bind (("C-c a c" . haskell-cabal-visit-file)))
;; Quickly duplicate whatever's under the cursor. I'm shocked this requires a ;; Quickly duplicate whatever's under the cursor. I'm shocked this requires a
;; third-party package; it should be standard. ;; third-party package; it should be standard.
(use-package duplicate-thing (use-package duplicate-thing
:bind (("C-c u" . duplicate-thing))) :bind (("C-c u" . duplicate-thing)))
;; I can never remember the hierarchies of certain bindings, like C-x v for version control ;; I can never remember the hierarchies of certain bindings, like C-x v for version control
;; stuff. Guide-key helps there. (TODO: figure out other places it'll help.) ;; stuff. Guide-key helps there. (TODO: figure out other places it'll help.)
(use-package guide-key (use-package guide-key
:diminish guide-key-mode :diminish guide-key-mode
:config :config
@@ -386,25 +348,12 @@
"C-c o" "C-c o"
))) )))
;; Since the in-emacs Dash browser doesn't work on OS X, we have to settle for dash-at-point.
(use-package dash-at-point
:bind ("C-c d" . dash-at-point))
;; Need to remember to use this more, though I have my issues with the UI.
(use-package dumb-jump
:disabled
:bind (("C-c j" . dumb-jump-go-prompt))
:config (setq dumb-jump-selector 'ivy))
(use-package elec-pair (use-package elec-pair
:config :config
(add-to-list 'electric-pair-pairs '(?` . ?`)) ; electric-quote backticks (add-to-list 'electric-pair-pairs '(?` . ?`)) ; electric-quote backticks
(add-to-list 'electric-pair-pairs '(?“ . ?”))) ; and curlies (add-to-list 'electric-pair-pairs '(?“ . ?”))) ; and curlies
;; OCaml is loaded not through melpa, but through OPAM itself. ;; OCaml is loaded not through melpa, but through OPAM itself.
(ignore-errors (ignore-errors
(autoload (expand-file-name "~/.opam/system/share/emacs/site-lisp/tuareg-site-file"))) (autoload (expand-file-name "~/.opam/system/share/emacs/site-lisp/tuareg-site-file")))
@@ -456,7 +405,6 @@
:config :config
;; TODO: build a real indentation solution ;; TODO: build a real indentation solution
(defun unindent-by-four () (defun unindent-by-four ()
(interactive) (interactive)
(indent-rigidly (region-beginning) (region-end) -4)) (indent-rigidly (region-beginning) (region-end) -4))
@@ -536,99 +484,6 @@
;; For Hammerspoon. ;; For Hammerspoon.
(use-package lua-mode) (use-package lua-mode)
;; Haskell is my programming language of choice.
(use-package haskell-mode
:config
(defun my-haskell-mode-hook ()
"Make sure the compile command is right."
(setq-local compile-command "stack build --fast"))
(unbind-key "C-c C-s" haskell-mode-map)
;; I don't go overboard with the symbols but they can be nice.
(setq haskell-font-lock-symbols 't
haskell-font-lock-symbols-alist
'(("\\" . "λ")
("<=" . "")
(">=" . "")
("==" . "")
("<>" . "")
("/=" . "")
("*" . "")
("<=<" . "<=<")
;; ("::" . "∷")
("<+>" . "")
("undefined" . "")
("forall" . "")
("." "" haskell-font-lock-dot-is-not-composition) ; or '◦'
))
;; Unfortunately haskell-mode doesn't quite track the latest and
;; greatest in Haskell extensions, so we have to give the font-lock
;; system a couple of hints.
(append-to-list haskell-ghc-supported-extensions
'("DerivingVia" "BlockArguments" "DerivingStrategies"))
(append-to-list haskell-font-lock-keywords '("capi" "via" "stock" "anyclass"))
(append-to-list haskell-language-extensions
'("-XDataKinds"
"-XDeriveFoldable"
"-XDeriveFunctor"
"-XDeriveGeneric"
"-XDeriveTraversable"
"-XFlexibleContexts"
"-XFlexibleInstances"
"-XMonadFailDesugaring"
"-XMultiParamTypeClasses"
"-XOverloadedStrings"
"-XRecordWildCards"
"-XStandaloneDeriving"
"-XStrictData"
"-XTypeApplications"))
:mode ("\\.hs$" . haskell-mode)
:hook (haskell-mode . my-haskell-mode-hook)
:bind (:map haskell-mode-map
("C-c a c" . haskell-cabal-visit-file)
("C-c a b" . haskell-mode-stylish-buffer)
("C-c a i" . haskell-navigate-imports)
("C-c a a" . haskell-mode-toggle-scc-at-point)
("C-c a w" . stack-watch)))
;; Intero… well, it sort-of works. It generally chokes on large projects,
;; but for sandboxes and small projects it's the best thing out there
;; (though I need to try dante-mode, or so joshvera tells me).
(use-package intero
:disabled
:after haskell-mode
:bind (:map haskell-mode-map
("C-c a r" . intero-repl)
("C-c a j" . intero-goto-definition)
("C-c a n" . intero-info)
("C-c a t" . intero-type-at)
("C-c a u" . intero-uses-at)
("C-c a s" . intero-apply-suggestions)))
(use-package attrap
:bind (("C-c q" . attrap-attrap)))
(use-package dante
:after haskell-mode
:bind (:map haskell-mode-map
("C-c a t" . dante-type-at)
("C-c a n" . dante-info)
("C-c a s" . attrap-attrap)
))
;; Someday I'm going to start using Idris again.
(use-package idris-mode
:disabled
:bind (("C-c C-v" . idris-case-split)))
(use-package typescript-mode :defer) (use-package typescript-mode :defer)
(use-package protobuf-mode) (use-package protobuf-mode)
@@ -777,30 +632,22 @@
make-backup-files nil ; No backups, thanks. make-backup-files nil ; No backups, thanks.
auto-save-default nil ; Or autosaves. What's the difference between autosaves and backups? auto-save-default nil ; Or autosaves. What's the difference between autosaves and backups?
create-lockfiles nil ; Emacs sure loves to put lockfiles everywhere. create-lockfiles nil ; Emacs sure loves to put lockfiles everywhere.
default-directory "~/src/" ; My code lives here. default-directory "~/Notes/" ; All my Notes are here.
inhibit-startup-screen t ; No need to see GNU agitprop. inhibit-startup-screen t ; No need to see GNU agitprop.
kill-whole-line t ; Lets C-k delete the whole line kill-whole-line t ; Lets C-k delete the whole line
mac-command-modifier 'super ; I'm not sure this is the right toggle, but whatever.
require-final-newline t ; Auto-insert trailing newlines. require-final-newline t ; Auto-insert trailing newlines.
ring-bell-function 'ignore ; Do not ding. Ever. ring-bell-function 'ignore ; Do not ding. Ever.
use-dialog-box nil ; Dialogues always go in the modeline. use-dialog-box nil ; Dialogues always go in the modeline.
frame-title-format "emacs %b" ; Put something useful in the status bar. frame-title-format "emacs %b" ; Put something useful in the status bar.
initial-scratch-message nil ; SHUT UP SHUT UP SHUT UP initial-scratch-message nil ; SHUT UP SHUT UP SHUT UP
mac-option-modifier 'meta ; why isn't this the default
save-interprogram-paste-before-kill t ; preserve paste to system ring save-interprogram-paste-before-kill t ; preserve paste to system ring
enable-recursive-minibuffers t ; don't fucking freak out if I use the minibuffer twice enable-recursive-minibuffers t ; don't fucking freak out if I use the minibuffer twice
sentence-end-double-space nil ; are you fucking kidding me with this shit sentence-end-double-space nil ; are you fucking kidding me with this shit
confirm-kill-processes nil ; don't whine at me when I'm quitting. confirm-kill-processes nil ; don't whine at me when I'm quitting.
mac-mouse-wheel-smooth-scroll nil ; no smooth scrolling
mac-drawing-use-gcd t ; and you can do it on other frames
mark-even-if-inactive nil ; prevent really unintuitive undo behavior mark-even-if-inactive nil ; prevent really unintuitive undo behavior
user-full-name "Patrick Thomson" ; it me user-full-name "Marcel Fries" ; it me
) )
;; dired whines at you on macOS unless you do this.
(when (eq system-type 'darwin)
(setq dired-use-ls-dired nil))
(setq-default (setq-default
cursor-type 'bar cursor-type 'bar
indent-tabs-mode nil indent-tabs-mode nil
@@ -810,7 +657,6 @@
(set-fill-column 95) (set-fill-column 95)
;; Always trim trailing whitespace. ;; Always trim trailing whitespace.
(add-hook 'before-save-hook 'delete-trailing-whitespace) (add-hook 'before-save-hook 'delete-trailing-whitespace)
;; (setq debug-on-error nil) ;; (setq debug-on-error nil)
@@ -823,10 +669,10 @@
(revert-buffer-function " %b" (revert-buffer-function " %b"
("%b - Dir: " default-directory))))))) ("%b - Dir: " default-directory)))))))
(require 'org-bullets) ;; Make org-mode look pretty
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) (use-package org-bullets
:init (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
;; Make check lists in org-mode pretty
(add-hook 'org-mode-hook (lambda () (add-hook 'org-mode-hook (lambda ()
"Beautify Org Checkbox Symbol" "Beautify Org Checkbox Symbol"
(push '("[ ]" . "") prettify-symbols-alist) (push '("[ ]" . "") prettify-symbols-alist)