Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(add-to-list 'package-archives '("marmalade" . ""))
(add-to-list 'package-archives '("melpa" . ""))
;; minimally, install use-package
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(blink-cursor-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(use-package package)
(use-package edit-server
:init (add-hook 'after-init-hook 'server-start t))
(set-face-attribute 'default nil
:family "Roboto Mono"
:height 110
:weight 'normal)
;; this makes using simple, inline lambdas much nicer
(defmacro interactively (&rest body)
(declare (indent 0))
`(lambda ()
(defalias 'yes-or-no-p 'y-or-n-p)
(setq-default indent-tabs-mode nil
tab-width 2
standard-indent 2)
;; emacs asks for the password, not a new popup
(setq epa-pinentry-mode 'loopback)
(setq show-trailing-whitespace t)
(setq browse-url-browser-function 'browse-url-chrome)
;; stop putting junk everywhere
(setq custom-file "/tmp/custom.el"
make-backup-files nil
auto-save-default nil
inhibit-startup-screen t)
(setq use-package-compute-statistics t)
(use-package recentf
:init (setq recentf-max-saved-items 50))
(use-package delight
:ensure t)
(use-package evil-leader
:ensure t
(evil-leader/set-leader "<SPC>")
"wv" 'split-window-right
"wh" 'split-window-below
"wb" 'balance-windows
"wm" 'delete-other-windows
"ww" 'other-window
"wd" 'delete-window
"w=" 'balance-windows
"bd" 'kill-this-buffer
"yb" (interactively (evil-yank (point-min) (point-max)))
"u" 'undo-tree-visualize
"nr" 'narrow-to-region
"nf" 'narrow-to-defun
"nw" 'widen
"kt" 'transpose-sexps
"dl" 'delete-matching-lines
"fe" (interactively (find-file "~/.emacs"))
;; as-in, clean
"c" (interactively
(replace-regexp "\n\n\n+" "\n\n"))))
(global-evil-leader-mode t)
(with-current-buffer "*Messages*"
(evil-leader-mode t)))
(use-package gist
:ensure t)
(use-package js2-mode
:mode ("\\.js$" . js2-mode)
:ensure t
:init (setq js2-strict-missing-semi-warning nil
js2-basic-offset 2))
(use-package yaml-mode
:ensure t)
(use-package git-timemachine
:hook (git-timemachine-mode . evil-normalize-keymaps)
:ensure t
:after evil
:config (evil-make-overriding-map git-timemachine-mode-map 'normal))
(use-package eldoc
:hook (clojure-mode . eldoc-mode)
(use-package cider
:ensure t
:hook ((cider--debug-mode-hook . evil-normalize-keymaps))
(defmacro evil-helper-cider-make-debug-command (&rest cider-commands)
"Make functions that wrap `cider-debug' commands.
Cider debug commands are sent through
`cider-debug-mode-send-reply'. ex. \(cider-debug-mode-send-reply
(let ((commands (if (consp cider-commands)
(list cider-commands))))
for command in commands
(let ((funsymbol
(intern (format "evil-helper-cider-debug-%s" command))))
`(defun ,funsymbol ()
"Send :%s to `cider-debug-mode-send-reply'." command)
(cider-debug-mode-send-reply ,(format ":%s" command))))))))
(evil-set-initial-state 'cider-stacktrace-mode 'normal)
(evil-define-key 'normal cider-stacktrace-mode-map
(kbd "q") cider-popup-buffer-quit-function)
(evil-leader/set-key-for-mode 'clojure-mode
"eb" 'cider-eval-buffer)
(evil-helper-cider-make-debug-command "next"
(dolist (key-com '(("n" . evil-helper-cider-debug-next)
("o" . evil-helper-cider-debug-out)
("L" . evil-helper-cider-debug-locals)
("c" . evil-helper-cider-debug-continue)
("q" . evil-helper-cider-debug-quit)))
(evil-define-key 'normal cider--debug-mode-hook
(kbd (car key-com)) (cdr key-com))))
(use-package inf-clojure
:ensure t
:after eldoc
:hook ((inf-clojure-mode . evil-normalize-keymaps)
(inf-clojure-mode . eldoc-mode)
(clojurescript-mode . inf-clojure-minor-mode)
(clojure-mode . inf-clojure-minor-mode))
:init (setq inf-clojure-lein-cmd "lein repl"
inf-clojure-generic-cmd "lumo -d"))
(use-package edit-server
:ensure t
:init (setq edit-server-new-frame nil)
:config (edit-server-start))
(use-package magit
:ensure t
"gs" 'magit))
(use-package evil-magit
:ensure t)
(use-package winum
:ensure t
:after (spaceline evil-leader)
:init (setq winum-mode-line-position 1
winum-auto-setup-mode-line nil ; because we want spaceline to do it
winum-numbering-scope 'global)
"1" 'winum-select-window-1
"2" 'winum-select-window-2
"3" 'winum-select-window-3
"4" 'winum-select-window-4
"5" 'winum-select-window-5))
(use-package anzu
:ensure t
:init (setq anzu-cons-mode-line-p nil)
:after spaceline)
(use-package all-the-icons
:ensure t)
(use-package evil-commentary
:ensure t
:after evil
:config (evil-commentary-mode t))
(use-package darktooth-theme
:ensure t
:config (load-theme 'darktooth t))
(use-package sublime-themes
:ensure t
:config (load-theme 'spolsky t))
(use-package solarized-theme
:ensure t
:init (setq solarized-high-contrast-mode-line t
x-underline-at-descent-line t)
(load-theme 'solarized-light t)
(set-face-attribute 'font-lock-keyword-face nil
:foreground "#cb4b16"))
(use-package doom-themes
:ensure t
:init (setq doom-themes-enable-bold t
doom-themes-enable-italic t)
(load-theme 'doom-dracula t)
(set-face-attribute 'fringe nil
:background "#282a36"))
(use-package rainbow-mode
:hook ((css-mode html-mode web-mode emacs-lisp-mode conf-mode) . rainbow-mode)
:ensure t)
(use-package spaceline
:ensure t
:after (evil)
:init (setq powerline-height 24
spaceline-highlight-face-func 'spaceline-highlight-face-evil-state
powerline-default-separator 'arrow)
(spaceline-helm-mode t))
(use-package helm-flyspell
:ensure t
:after (flyspell helm))
(use-package helm
:ensure t
:defer nil
:after evil-leader
:bind (("M-x" . helm-M-x)
:map helm-map
("C-j" . helm-next-line)
("C-k" . helm-previous-line)
("C-h" . helm-next-source)
("C-l" . "
"bb" 'helm-buffers-list
"P" 'helm-show-kill-ring)
(helm-mode t))
(use-package helm-files
:after evil-leader
:defer nil
:bind (:map helm-find-files-map
("C-l" . helm-execute-persistent-action)
("C-h" . helm-find-files-up-one-level))
:config (evil-leader/set-key
"fh" (interactively
(let ((newbie (split-window-below)))
(select-window newbie)
(helm-find-files nil)))
"fv" (interactively
(let ((newbie (split-window-right)))
(select-window newbie)
(helm-find-files nil)))
"fr" 'helm-recentf
"ff" 'helm-find-files))
(use-package projectile
:ensure t
:after evil-leader
"fp" 'helm-projectile-find-file
"pf" 'helm-projectile-find-file-dwim
"ps" 'helm-projectile-ag)
(use-package helm-projectile
:ensure t
:after (helm projectile)
:config (helm-projectile-on))
(use-package flyspell
:ensure t
:hook (((clojure-mode emacs-lisp-mode) . flyspell-prog-mode)
((text-mode markdown-mode) . flyspell-mode))
:init (setq-default ispell-program-name "aspell"
ispell-local-dictionary "en_GB")
"sw" 'helm-flyspell-correct
"sb" 'flyspell-buffer
"sn" 'flyspell-goto-next-error)
;; don't spellcheck inline code faces for markdown-mode
(setq flyspell-generic-check-word-predicate
#'(lambda ()
(let ((f (get-text-property (- (point) 1) 'face)))
(not (memq f '(markdown-pre-face
(use-package clojure-mode
:ensure t)
(use-package yasnippet
:ensure t
:init (setq yas-snippet-dirs '("~/.snippets"))
:delight yas-minor-mode
:config (yas-global-mode 1))
(use-package helm-c-yasnippet
:ensure t
:after (yasnippet helm)
:init (setq helm-yas-space-match-any-greedy t)
:config (evil-leader/set-key
"/" 'helm-yas-complete))
(use-package evil-visualstar
:ensure t
:after evil
:config (global-evil-visualstar-mode))
(use-package helm-ag
:ensure t
:after helm)
(use-package json-mode
:ensure t
:init (setq js-indent-level standard-indent))
(use-package drag-stuff
:ensure t
:bind (:map evil-normal-state-map
("<up>" . drag-stuff-up)
("<down>" . drag-stuff-down)
:map evil-visual-state-map
("<up>" . drag-stuff-up)
("<down>" . drag-stuff-down)))
(use-package org
:ensure t)
(use-package evil-matchit
:ensure t
:after evil
:config (global-evil-matchit-mode 1))
(use-package evil-numbers
:ensure t
:after evil
:bind (:map evil-normal-state-map
("C-a" . evil-numbers/inc-at-pt)
("C-z" . evil-numbers/dec-at-pt)))
(use-package expand-region
:ensure t
:config (define-key evil-normal-state-map (kbd ";") 'er/expand-region))
(use-package iedit
:ensure t
:bind (:map evil-normal-state-map
("C-;" . iedit-mode)
:map evil-visual-state-map
("C-;" . iedit-mode))
:config (set-face-attribute 'iedit-occurrence nil
:background "orange"
:foreground "black"))
(use-package hydra
:ensure t
(defhydra hydra-text-zoom (:hint t)
"Font size"
("k" text-scale-increase "up")
("j" text-scale-decrease "down")
("0" (text-scale-set 0) "reset"))
"F" 'hydra-text-zoom/body))
(use-package evil
:ensure t
:delight undo-tree-mode
:after evil-leader
:bind (:map evil-insert-state-map
("TAB" . indent-for-tab-command)
:map evil-normal-state-map
("k" . evil-previous-visual-line)
("j" . evil-next-visual-line)
("TAB" . indent-for-tab-command))
:init (setq evil-default-cursor t
evil-want-fine-undo t
evil-shift-width 1
evil-shift-round nil)
:config (evil-mode 1))
(use-package evil-smartparens
:ensure t
:after smartparens
:hook ((clojurescript-mode
emacs-lisp-mode) . evil-smartparens-mode))
(use-package smartparens
:ensure t
;; a load of sensible configuration for individual modes
(require 'smartparens-config)
"(" (interactively
(sp-wrap-with-pair "(")
"ks" 'sp-forward-slurp-sexp
"kw" 'sp-splice-sexp)
:hook ((clojurescript-mode clojure-mode emacs-lisp-mode) . smartparens-strict-mode))
(use-package mu4e
:load-path "~/elisp"
(require 'mu4e-config)
(evil-leader/set-key-for-mode 'mu4e-compose-mode
"h" 'org-mime-htmlize
"C" 'message-send-and-exit)
"Ea" 'mu4e))
(use-package evil-mu4e
:ensure t
:after mu4e)
(use-package helm-mu
:ensure t
:after mu4e
:config (evil-leader/set-key
"Em" 'helm-mu-contacts
"Es" 'helm-mu))
(use-package desktop
:init (setq desktop-dirname "~/.emacs.d/"
desktop-path (list desktop-dirname)
desktop-base-file-name "desktop.el"
desktop-base-lock-name "lock"
desktop-save t
desktop-files-not-to-save "^$"
desktop-load-locked-desktop nil
desktop-auto-save-timeout 30)
:config (desktop-save-mode 1))
(use-package which-key
:ensure t
:config (which-key-mode t))
(use-package scala-mode
:interpreter ("scala" . scala-mode)
:ensure t)
(use-package persistent-scratch
:ensure t
:init (setq persistent-scratch-save-file (concat "~/Dropbox/" system-name ".scratch.el"))
:config (persistent-scratch-setup-default))
(use-package emmet-mode
:ensure t
:hook (sgml-mode . emmet-mode)
:bind (:map evil-insert-state-map
("M-j" . emmet-expand-line)))
(use-package exec-path-from-shell
:ensure t
:config (exec-path-from-shell-initialize))
(use-package web-mode
:ensure t
:mode (("\\.html\\'" . web-mode)
("\\.handlebars" . web-mode)))
(use-package rainbow-delimiters
:ensure t
:hook ((clojurescript-mode clojure-mode emacs-lisp-mode) . rainbow-delimiters-mode))
(use-package company
:ensure t
:bind (:map evil-insert-state-map
("C-k" . company-select-previous)
("C-j" . company-select-next))
:init (setq company-idle-delay 0.2
company-dabbrev-downcase 0)
:hook ((clojurescript-mode
mu4e-compose-mode) . company-mode))
(use-package aggressive-indent
:ensure t
:hook ((clojurescript-mode clojure-mode emacs-lisp-mode) . aggressive-indent-mode))
(use-package markdown-mode
:ensure t
:init (setq markdown-fontify-code-blocks-natively t)
(set-face-attribute 'markdown-header-face-1 nil
:height 150)
(set-face-attribute 'markdown-header-face-2 nil
:height 130))
(use-package dired
:bind ((:map dired-mode-map
("g" . revert-buffer)
("e" . dired-toggle-read-only)))
(setq dired-recursive-deletes 'always
dired-recursive-copies 'always
dired-listing-switches "-alGhvF --group-directories-first")
"fj" 'dired-jump))
(use-package highlight-symbol
:ensure t
:hook ((clojurescript-mode clojure-mode emacs-lisp-mode) . highlight-symbol-mode))
(use-package ediff
:init (setq ediff-window-setup-function 'ediff-setup-windows-plain))
(use-package evil-ediff
:after ediff
:ensure t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment