Skip to content

Instantly share code, notes, and snippets.

@minimal
Forked from philjackson/emacs-config.el
Created April 19, 2018 11:36
Show Gist options
  • Save minimal/c718c37cb715cfce19f2ab796136ef67 to your computer and use it in GitHub Desktop.
Save minimal/c718c37cb715cfce19f2ab796136ef67 to your computer and use it in GitHub Desktop.
(require 'package)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
;; minimally, install use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(blink-cursor-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(show-paren-mode)
(server-start)
(set-default-font "Roboto Mono 11")
;; this makes using simple, inline lambdas much nicer
(defmacro interactively (&rest body)
(declare (indent 0))
`(lambda ()
(interactive)
,@body))
(defalias 'yes-or-no-p 'y-or-n-p)
(setq-default indent-tabs-mode nil
tab-width 2
standard-indent 2)
(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 diminish
:ensure t)
(use-package gist
:ensure t)
(use-package js2-mode
:mode ("\\.js$" . js2-mode)
:ensure t
:init
(setq js2-strict-missing-semi-warning nil)
(setq 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 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 markdown-mode
:ensure t
:init (setq markdown-fontify-code-blocks-natively t))
(use-package eldoc
:hook (clojure-mode . eldoc-mode)
:diminish eldoc-mode)
(use-package inf-clojure
:ensure t
:after eldoc
:hook ((inf-clojure-mode . evil-normalize-keymaps)
(inf-clojure-mode . eldoc-mode)
(clojure-mode . inf-clojure-minor-mode))
:init (setq inf-clojure-generic-cmd "lumo -d -c src"))
(use-package edit-server
:ensure t
:init (setq edit-server-new-frame nil)
:config (edit-server-start))
(use-package magit
:ensure t)
(use-package evil-magit
:ensure t
:after magit)
(use-package winum
:ensure t
:after spaceline
:init (setq winum-mode-line-position 1
winum-auto-setup-mode-line nil ; because we want spaceline to do it
winum-numbering-scope 'global)
:config (winum-mode))
(use-package anzu
:ensure t
:init (setq anzu-cons-mode-line-p nil)
:diminish anzu-mode
:after spaceline)
(use-package all-the-icons
:ensure t)
(use-package evil-commentary
:ensure t
:after evil
:diminish evil-commentary-mode
:config (evil-commentary-mode t))
(use-package darktooth-theme
:ensure t
:disabled t
:config (load-theme 'darktooth t))
(use-package sublime-themes
:ensure t
:disabled t
:config (load-theme 'spolsky t))
(use-package doom-themes
:ensure t
:init (setq doom-themes-enable-bold t
doom-themes-enable-italic t)
:config (load-theme 'doom-dracula t))
(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 all-the-icons)
:init (setq powerline-height 24
spaceline-highlight-face-func 'spaceline-highlight-face-evil-state
powerline-default-separator 'arrow)
:config
(spaceline-spacemacs-theme)
(spaceline-helm-mode t))
(use-package evil-leader
:after evil
:ensure t
:config (global-evil-leader-mode))
(use-package paredit
:ensure t
:diminish paredit-mode
:after evil-paredit ; due to hook orders
:hook ((clojurescript-mode clojure-mode emacs-lisp-mode) . paredit-mode))
(use-package evil-paredit
:ensure t
:hook ((clojurescript-mode clojure-mode emacs-lisp-mode) . evil-paredit-mode)
:after evil)
(use-package helm-flyspell
:ensure t
:after (flyspell helm))
(use-package dired
:config
(setq dired-recursive-deletes 'always)
(setq dired-recursive-copies 'always)
(define-key dired-mode-map (kbd "e") 'dired-toggle-read-only))
(use-package helm
:ensure t
: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" . "
")))
(use-package helm-files
:bind (:map helm-find-files-map
("C-l" . helm-execute-persistent-action)
("C-h" . helm-find-files-up-one-level)))
(use-package projectile
:ensure t
:diminish projectile-mode
:config (projectile-global-mode))
(use-package helm-projectile
:ensure t
:after (helm projectile)
:config (helm-projectile-on))
(use-package flyspell
:ensure t
:diminish flyspell-mode
:hook ((clojure-mode emacs-lisp-mode text-mode markdown-mode) . flyspell-prog-mode)
:init (setq-default ispell-program-name "aspell"
ispell-local-dictionary "en_GB")
:config
;; 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
markdown-inline-code-face)))))))
(use-package clojure-mode
:ensure t)
(use-package yasnippet
:ensure t
:init (setq yas-snippet-dirs '("~/.snippets"))
:diminish yas-minor-mode
:config (yas-global-mode 1))
(use-package evil-visualstar
:ensure t
: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)
(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
:config (set-face-attribute 'iedit-occurrence nil
:background "orange"
:foreground "black"))
(use-package git-gutter
:ensure t
:diminish git-gutter-mode
:config
(global-git-gutter-mode t)
(set-face-attribute 'git-gutter:modified nil
:foreground "orange"))
(use-package hydra
:ensure t
:config
(defhydra hydra-git-gutter-nav (:hint t)
"Git gutter nav"
("j" git-gutter:previous-hunk "up")
("k" git-gutter:next-hunk "down"))
(defhydra hydra-text-zoom (:hint t)
"Font size"
("k" text-scale-increase "up")
("j" text-scale-decrease "down")
("0" (text-scale-set 0) "reset")))
(use-package evil
:ensure t
:diminish undo-tree-mode
:bind (:map evil-insert-state-map
("TAB" . indent-for-tab-command)
:map evil-visual-state-map
("<up>" . drag-stuff-up)
("<down>" . drag-stuff-down)
("C-;" . iedit-mode)
:map evil-normal-state-map
("k" . evil-previous-visual-line)
("j" . evil-next-visual-line)
("<up>" . drag-stuff-up)
("<down>" . drag-stuff-down)
("C-;" . iedit-mode)
("TAB" . indent-for-tab-command))
:config
(evil-mode 1)
(setq evil-default-cursor t
evil-shift-width 1
evil-shift-round nil)
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"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
"F" 'hydra-text-zoom/body
"wv" 'split-window-right
"wh" 'split-window-below
"wb" 'balance-windows
"wm" 'delete-other-windows
"ww" 'other-window
"wd" 'delete-window
"w=" 'balance-windows
"sw" 'helm-flyspell-correct
"sn" 'flyspell-goto-next-error
"/" 'helm-yas-complete
"bd" 'kill-this-buffer
"bb" 'helm-buffers-list
"pf" 'helm-projectile-find-file-dwim
"ps" 'helm-projectile-ag
"yb" (interactively
(evil-yank (point-min) (point-max)))
"u" 'undo-tree-visualize
"P" 'helm-show-kill-ring
"nr" 'narrow-to-region
"nf" 'narrow-to-defun
"nw" 'widen
"gs" 'magit
"gn" 'hydra-git-gutter-nav/body
"ks" 'paredit-forward-slurp-sexp
"kw" 'paredit-splice-sexp
"kt" 'transpose-sexps
"dl" 'delete-matching-lines
;; as-in, clean
"c" (interactively
(delete-trailing-whitespace)
(save-excursion
(beginning-of-buffer)
(replace-regexp "\n\n\n+" "\n\n")))
"fj" 'dired-jump
"fr" 'helm-recentf
"ff" 'helm-find-files)
;; messages has already been created
(with-current-buffer "*Messages*"
(evil-leader-mode t)))
(use-package company
:ensure t
:bind (:map evil-insert-state-map
("C-k" . company-select-previous)
("C-j" . company-select-next))
:diminish company-mode
:config (global-company-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment