diff options
author | Vincent Ambo <mail@tazj.in> | 2018-06-22T08·29+0200 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2019-02-10T20·43+0100 |
commit | 4fe8d78dbb16dbec2b8c173a5142b4b14927fd28 (patch) | |
tree | 481bd47ba446167088f846f9eeb383a847dc7d86 /init.el | |
parent | f0dfc8b06de568e57050510a5b56fcbb725a6733 (diff) |
refactor: Begin moving package configuration to use-package
This is the first in a series of commits for refactoring my configuration to make use of jwiegley's use-package. In the previous layout of the configuration there were some questions around what settings go into which file, but in the end it is all just related to which packages are being configured (besides settings related to global Emacs behaviour). This commit introduces use-package forms for all currently used packages (which are still installed via Nix, not via package.el) but does not yet clean up the rest of the configuration in a suitable way. Note that this version introduces a bug in which the configuration of telephone line is not correctly initialised after package setup.
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 147 |
1 files changed, 139 insertions, 8 deletions
diff --git a/init.el b/init.el index b73eaccef508..7a4af106066c 100644 --- a/init.el +++ b/init.el @@ -3,11 +3,149 @@ ;; Packages are installed via Nix configuration, this file only ;; initialises the newly loaded packages. -(require 'package) +(require 'use-package) (require 'seq) (package-initialize) +;; Add 'init' folder that contains other settings to load. +(add-to-list 'load-path (concat user-emacs-directory "init")) + +;; 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)) + :init + (progn (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a) + aw-scope 'frame) + ;; Show previews of ace-window numbers in the mode line for each window. + (ace-window-display-mode))) + +(use-package adjust-parens :hook ((lisp-mode . adjust-parens-hook))) +(use-package auth-source-pass :init (auth-source-pass-enable)) + +(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)) + :bind (:map rust-mode-map ("<tab>" . company-indent-or-complete-common) + :map lisp-mode-map ("<tab>" . company-indent-or-complete-common)) + :init (setq company-tooltip-align-annotations t)) + +(use-package dash) +(use-package dash-functional) +(use-package edit-server :init (edit-server-start)) +(use-package gruber-darker-theme) +(use-package ht) +(use-package hydra) +(use-package idle-highlight-mode :hook ((prog-mode . idle-highlight-mode))) +(use-package paredit :hook ((lisp-mode . paredit-mode))) +(use-package multiple-cursors) + +(use-package pinentry + :init + (setq epa-pinentry-mode 'loopback) + (pinentry-start)) + +(use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) +(use-package rainbow-mode) +(use-package s) +(use-package smartparens :init (smartparens-global-mode)) +(use-package string-edit) +(use-package telephone-line :init (telephone-line-setup)) +(use-package undo-tree :init (global-undo-tree-mode)) +(use-package uuidgen) +(use-package which-key :init (which-key-mode t)) + +;; +;; Applications in emacs +;; + +(use-package magit + :bind ("C-c g" . magit-status) + :init (setq magit-repository-directories '(("/home/vincent/projects" . 2)))) + +(use-package multi-term + :bind ("C-x t" . counsel-switch-to-term) + :init (progn + ;; term-mode's attempt to use isearch is not my favourite thing in the + ;; world. + (delete '("C-r" . isearch-backward) term-bind-key-alist) + (delete '("C-s" . isearch-forward) term-bind-key-alist) + + (add-to-list 'term-bind-key-alist '("C-r" . term-send-reverse-search-history)) + (add-to-list 'term-bind-key-alist '("C-c C-l" . term-line-mode)) + (add-to-list 'term-bind-key-alist '("C-s" . swiper)) + (add-to-list 'term-bind-key-alist '("C-c C-r" . term-rename)))) + +(use-package password-store) +(use-package pg) +(use-package restclient) + +;; +;; Packages providing language-specific functionality +;; + +(use-package cargo :hook ((rust-mode . cargo-minor-mode) + (cargo-process-mode . visual-line-mode))) + +(use-package dockerfile-mode) + +(use-package eglot + :init (defvar rust-eglot-initialized nil) + :hook ((rust-mode . (lambda () + (unless rust-eglot-initialized + (call-interactively #'eglot) + (setq rust-eglot-initialized t)))))) + +(use-package erlang + :hook ((erlang-mode . (lambda () + ;; Don't indent after '>' while I'm writing + (local-set-key ">" 'self-insert-command))))) + +(use-package go-mode) +(use-package haskell-mode) + +(use-package jq-mode + :init (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode))) + +(use-package kotlin-mode) + +(use-package markdown-mode + :init + (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) +(use-package nginx-mode) +(use-package rust-mode) +(use-package terraform-mode) +(use-package toml-mode) +(use-package web-mode) +(use-package yaml-mode) + +;; (use-package sly +;; :init +;; (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) +;; (add-to-list 'company-backends 'sly-company)) + +;; +;; EXWM / NixOS related packages +;; + ;; Configure a few basics before moving on to package-specific initialisation. (setq custom-file (concat user-emacs-directory "init/custom.el")) (load custom-file) @@ -18,9 +156,6 @@ ;; Seed RNG (random t) -;; Add 'init' folder that contains other settings to load. -(add-to-list 'load-path (concat user-emacs-directory "init")) - ;; Load configuration that makes use of installed packages: ;; Emacs will automatically initialise all installed packages. @@ -35,12 +170,8 @@ bindings term-setup eshell-setup - haskell-setup - rust-setup - lisp-setup ))) (add-hook 'after-init-hook 'load-other-settings) (put 'narrow-to-region 'disabled nil) -(edit-server-start) (put 'upcase-region 'disabled nil) |