2017-11-12 19:46:14 +01:00
|
|
|
;;; init.el --- Package bootstrapping. -*- lexical-binding: t; -*-
|
|
|
|
|
2018-03-04 00:14:13 +01:00
|
|
|
;; Packages are installed via Nix configuration, this file only
|
|
|
|
;; initialises the newly loaded packages.
|
2017-11-12 19:46:14 +01:00
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
(require 'use-package)
|
2017-11-12 19:46:14 +01:00
|
|
|
(require 'seq)
|
2013-07-08 01:15:05 +02:00
|
|
|
|
2017-11-12 20:24:21 +01:00
|
|
|
(package-initialize)
|
2013-07-08 01:15:05 +02:00
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
;; Initialise all packages installed via Nix.
|
|
|
|
;;
|
|
|
|
;; TODO: Generate this section in Nix for all packages that do not
|
|
|
|
;; require special configuration.
|
|
|
|
|
|
|
|
;;
|
|
|
|
;; Packages providing generic functionality.
|
|
|
|
;;
|
|
|
|
|
|
|
|
(use-package ace-window
|
|
|
|
:bind (("C-x o" . ace-window))
|
2019-12-15 23:15:11 +01:00
|
|
|
:config
|
2018-11-13 15:35:37 +01:00
|
|
|
(setq aw-keys '(?f ?j ?d ?k ?s ?l ?a)
|
|
|
|
aw-scope 'frame))
|
2018-06-22 10:29:31 +02:00
|
|
|
|
2019-12-15 23:15:11 +01:00
|
|
|
(use-package auth-source-pass :config (auth-source-pass-enable))
|
2018-06-22 10:29:31 +02:00
|
|
|
|
|
|
|
(use-package avy
|
|
|
|
:bind (("M-j" . avy-goto-char)
|
|
|
|
("M-p" . avy-pop-mark)
|
|
|
|
("M-g g" . avy-goto-line)))
|
|
|
|
|
|
|
|
(use-package browse-kill-ring)
|
|
|
|
|
|
|
|
(use-package company
|
|
|
|
:hook ((prog-mode . company-mode))
|
2019-12-15 23:15:11 +01:00
|
|
|
:config (setq company-tooltip-align-annotations t))
|
2018-06-22 10:29:31 +02:00
|
|
|
|
2019-12-17 12:46:41 +01:00
|
|
|
(use-package counsel
|
|
|
|
:after (ivy)
|
|
|
|
:config (counsel-mode 1)
|
|
|
|
:bind (("C-c r g" . counsel-rg)))
|
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package dash)
|
|
|
|
(use-package dash-functional)
|
2019-12-15 23:14:31 +01:00
|
|
|
(use-package dottime :config (dottime-display-mode t))
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package gruber-darker-theme)
|
|
|
|
(use-package ht)
|
|
|
|
(use-package hydra)
|
|
|
|
(use-package idle-highlight-mode :hook ((prog-mode . idle-highlight-mode)))
|
2019-12-17 12:46:41 +01:00
|
|
|
|
|
|
|
(use-package ivy
|
|
|
|
:config
|
|
|
|
(ivy-mode 1)
|
|
|
|
(setq enable-recursive-minibuffers t)
|
|
|
|
(setq ivy-use-virtual-buffers t))
|
|
|
|
|
|
|
|
(use-package ivy-pass :after (ivy))
|
|
|
|
|
|
|
|
(use-package ivy-prescient
|
|
|
|
:after (ivy prescient)
|
|
|
|
:config
|
2019-12-17 12:46:58 +01:00
|
|
|
(ivy-prescient-mode)
|
|
|
|
;; Fixes an issue with how regexes are passed to ripgrep from counsel,
|
|
|
|
;; see raxod502/prescient.el#43
|
|
|
|
(setf (alist-get 'counsel-rg ivy-re-builders-alist) #'ivy--regex-plus))
|
2019-12-17 12:46:41 +01:00
|
|
|
|
|
|
|
(use-package multiple-cursors)
|
|
|
|
|
2018-06-28 11:01:54 +02:00
|
|
|
(use-package paredit :hook ((lisp-mode . paredit-mode)
|
|
|
|
(emacs-lisp-mode . paredit-mode)))
|
2019-12-17 12:46:41 +01:00
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package pinentry
|
2019-12-15 23:15:11 +01:00
|
|
|
:config
|
2018-06-22 10:29:31 +02:00
|
|
|
(setq epa-pinentry-mode 'loopback)
|
|
|
|
(pinentry-start))
|
|
|
|
|
2019-12-17 12:46:41 +01:00
|
|
|
(use-package prescient
|
|
|
|
:after (ivy counsel)
|
|
|
|
:config (prescient-persist-mode))
|
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode))
|
|
|
|
(use-package rainbow-mode)
|
|
|
|
(use-package s)
|
|
|
|
(use-package string-edit)
|
2019-12-17 12:46:41 +01:00
|
|
|
|
|
|
|
(use-package swiper
|
|
|
|
:after (counsel ivy)
|
|
|
|
:bind (("C-s" . swiper)))
|
|
|
|
|
2018-06-28 11:02:24 +02:00
|
|
|
(use-package telephone-line) ;; configuration happens outside of use-package
|
2019-12-15 23:54:40 +01:00
|
|
|
(use-package term-switcher)
|
2019-12-15 23:15:11 +01:00
|
|
|
(use-package undo-tree :config (global-undo-tree-mode))
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package uuidgen)
|
2019-12-15 23:15:11 +01:00
|
|
|
(use-package which-key :config (which-key-mode t))
|
2018-06-22 10:29:31 +02:00
|
|
|
|
|
|
|
;;
|
|
|
|
;; Applications in emacs
|
|
|
|
;;
|
|
|
|
|
|
|
|
(use-package magit
|
|
|
|
:bind ("C-c g" . magit-status)
|
2019-12-16 11:04:46 +01:00
|
|
|
:config (setq magit-repository-directories '(("/home/tazjin/projects" . 2)
|
2019-12-17 12:47:30 +01:00
|
|
|
("/home/tazjin" . 1))))
|
2018-06-22 10:29:31 +02:00
|
|
|
|
|
|
|
(use-package password-store)
|
|
|
|
(use-package pg)
|
|
|
|
(use-package restclient)
|
|
|
|
|
2019-12-16 04:49:07 +01:00
|
|
|
(use-package vterm
|
|
|
|
:config (progn
|
|
|
|
(setq vterm-shell "/usr/bin/fish")
|
|
|
|
(setq vterm-exit-functions
|
|
|
|
(lambda (&rest _) (kill-buffer (current-buffer))))
|
|
|
|
(setq vterm-set-title-functions
|
|
|
|
(lambda (title)
|
|
|
|
(rename-buffer
|
|
|
|
(generate-new-buffer-name
|
|
|
|
(format "vterm<%s>"
|
|
|
|
(s-trim-left
|
|
|
|
(s-chop-prefix "fish" title)))))))))
|
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
;;
|
|
|
|
;; Packages providing language-specific functionality
|
|
|
|
;;
|
|
|
|
|
2018-09-02 18:14:12 +02:00
|
|
|
(use-package cargo
|
|
|
|
:hook ((rust-mode . cargo-minor-mode)
|
|
|
|
(cargo-process-mode . visual-line-mode))
|
|
|
|
:bind (:map cargo-minor-mode-map ("C-c C-c C-l" . ignore)))
|
2018-06-22 10:29:31 +02:00
|
|
|
|
|
|
|
(use-package dockerfile-mode)
|
|
|
|
|
|
|
|
(use-package erlang
|
|
|
|
:hook ((erlang-mode . (lambda ()
|
|
|
|
;; Don't indent after '>' while I'm writing
|
|
|
|
(local-set-key ">" 'self-insert-command)))))
|
|
|
|
|
2019-12-14 14:35:03 +01:00
|
|
|
(use-package f)
|
|
|
|
|
2019-12-14 14:23:20 +01:00
|
|
|
(use-package go-mode
|
2019-12-14 16:59:20 +01:00
|
|
|
:bind (:map go-mode-map ("C-c C-r" . recompile))
|
2019-12-14 14:23:20 +01:00
|
|
|
:hook ((go-mode . (lambda ()
|
|
|
|
(setq tab-width 2)
|
|
|
|
(setq-local compile-command
|
|
|
|
(concat "go build " buffer-file-name))))))
|
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package haskell-mode)
|
|
|
|
|
|
|
|
(use-package jq-mode
|
2019-12-15 23:15:11 +01:00
|
|
|
:config (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode)))
|
2018-06-22 10:29:31 +02:00
|
|
|
|
2018-10-12 19:11:43 +02:00
|
|
|
(use-package kotlin-mode
|
2019-12-14 16:59:20 +01:00
|
|
|
:hook ((kotlin-mode . (lambda ()
|
|
|
|
(setq indent-line-function #'indent-relative)))))
|
2018-06-22 10:29:31 +02:00
|
|
|
|
2019-12-14 14:23:20 +01:00
|
|
|
(use-package lsp-mode)
|
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package markdown-mode
|
2019-12-15 23:15:11 +01:00
|
|
|
:config
|
2018-06-22 10:29:31 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)))
|
|
|
|
|
|
|
|
(use-package markdown-toc)
|
2018-10-28 23:39:58 +01:00
|
|
|
|
|
|
|
(use-package nix-mode
|
2019-12-14 16:59:20 +01:00
|
|
|
:hook ((nix-mode . (lambda ()
|
|
|
|
(setq indent-line-function #'nix-indent-line)))))
|
2018-10-28 23:39:58 +01:00
|
|
|
|
2019-12-19 15:22:33 +01:00
|
|
|
(use-package nix-util)
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package nginx-mode)
|
|
|
|
(use-package rust-mode)
|
2019-12-19 16:19:24 +01:00
|
|
|
|
|
|
|
(use-package telega
|
|
|
|
:bind (:map global-map ("s-t" . telega))
|
|
|
|
:config (telega-mode-line-mode 1))
|
|
|
|
|
2018-06-22 10:29:31 +02:00
|
|
|
(use-package terraform-mode)
|
|
|
|
(use-package toml-mode)
|
|
|
|
(use-package web-mode)
|
|
|
|
(use-package yaml-mode)
|
|
|
|
|
2019-12-14 16:38:03 +01:00
|
|
|
;; Configuration changes in `customize` can not actually be persisted
|
|
|
|
;; to the customise file that Emacs is currently using (since it comes
|
|
|
|
;; from the Nix store).
|
|
|
|
;;
|
|
|
|
;; The way this will work for now is that Emacs will *write*
|
|
|
|
;; configuration to the file tracked in my repository, while not
|
|
|
|
;; actually *reading* it from there (unless Emacs is rebuilt).
|
2019-12-14 18:15:18 +01:00
|
|
|
(setq custom-file (expand-file-name "~/depot/tools/emacs/config/custom.el"))
|
|
|
|
(load-library "custom")
|
2013-07-08 01:15:05 +02:00
|
|
|
|
2018-06-28 11:02:24 +02:00
|
|
|
(defvar home-dir (expand-file-name "~"))
|
2013-08-05 11:54:38 +02:00
|
|
|
|
2013-07-08 01:15:05 +02:00
|
|
|
;; Seed RNG
|
|
|
|
(random t)
|
|
|
|
|
2019-12-14 16:24:53 +01:00
|
|
|
;; Load all other Emacs configuration. These configurations are
|
|
|
|
;; added to `load-path' by Nix.
|
|
|
|
(mapc 'require '(desktop
|
|
|
|
mail-setup
|
|
|
|
look-and-feel
|
|
|
|
functions
|
|
|
|
settings
|
|
|
|
modes
|
|
|
|
bindings
|
|
|
|
eshell-setup))
|
|
|
|
(telephone-line-setup)
|
|
|
|
(ace-window-display-mode)
|
|
|
|
|
2019-12-16 14:33:29 +01:00
|
|
|
;; If a local configuration library exists, it should be loaded.
|
|
|
|
;;
|
|
|
|
;; This can be provided by calling my Emacs derivation with
|
|
|
|
;; `withLocalConfig'.
|
|
|
|
(if-let (local-file (locate-library "local"))
|
|
|
|
(load local-file))
|
2018-11-13 15:35:37 +01:00
|
|
|
|
2019-12-14 16:24:53 +01:00
|
|
|
(provide 'init)
|