Last active
February 19, 2017 03:33
-
-
Save jmglov/630882f4609e941586e1141057a45982 to your computer and use it in GitHub Desktop.
Emacs configuration for Clojure development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa-stable" . "http://stable.melpa.org/packages/") t) | |
(add-to-list 'package-archives | |
'("melpa.org" . "http://melpa.org/packages/") t) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/") t) | |
(package-initialize) | |
(add-to-list 'package-pinned-packages '(cider . "melpa-stable") t) | |
(add-to-list 'package-pinned-packages '(magit . "melpa-stable") t) | |
(add-to-list 'package-pinned-packages '(magit-popup . "melpa-stable") t) | |
(when (not package-archive-contents) | |
(package-refresh-contents)) | |
;; packages | |
(defvar my-packages '(atom-one-dark-theme | |
clojure-mode | |
cider | |
company | |
exec-path-from-shell | |
magit | |
racket-mode | |
rainbow-delimiters | |
starter-kit | |
starter-kit-lisp | |
starter-kit-bindings) | |
"A list of packages to ensure are installed at launch.") | |
(dolist (p my-packages) | |
(when (not (package-installed-p p)) | |
(package-install p))) | |
(when (memq window-system '(mac ns)) | |
(exec-path-from-shell-initialize)) | |
;; UI | |
(setq frame-title-format '(multiple-frames "%b" "%b")) ; frame-title shows filename | |
(set-variable 'inhibit-startup-message t) | |
(setq visible-bell t) | |
(load-theme 'atom-one-dark t) | |
(set-default-font "Source Code Pro Medium:style=Medium,Regular 12") | |
;; Character encoding | |
(setq locale-coding-system 'utf-8) | |
(set-terminal-coding-system 'utf-8) | |
(set-keyboard-coding-system 'utf-8) | |
(set-selection-coding-system 'utf-8) | |
(prefer-coding-system 'utf-8) | |
(set-language-environment "UTF-8") | |
(fset 'yes-or-no-p 'y-or-n-p) | |
;; Text and indentation | |
(setq default-truncate-lines t) ; no line wrap | |
(electric-indent-mode +1) ; auto-indent on return | |
(setq js-indent-level 2) | |
(setq sh-basic-offset 2) | |
(setq sh-indentation 2) | |
(setq ispell-program-name "aspell") | |
(add-hook 'text-mode-hook 'visual-line-mode) | |
(add-hook 'text-mode-hook 'flyspell-mode) | |
;; Keybindings | |
(global-set-key (kbd "<C-tab>") 'next-multiframe-window) | |
(global-set-key (kbd "<M-insert>") 'clipboard-yank) | |
(global-set-key (kbd "C-x C-b") 'ibuffer) | |
(global-set-key (kbd "C-c .") 'eval-region) | |
(global-set-key (kbd "C-c /") 'comment-or-uncomment-region) | |
(global-set-key (kbd "C-c g") 'magit-status) | |
;; File extensions | |
(add-to-list 'auto-mode-alist '("\.cljs$" . clojure-mode)) | |
(add-to-list 'auto-mode-alist '("\.pxi$" . clojure-mode)) | |
;; Clojure | |
(setq nrepl-hide-special-buffers t) | |
(add-hook 'clojure-mode-hook 'cider-mode) | |
(add-hook 'cider-mode-hook 'company-mode) | |
(add-hook 'cider-mode-hook 'paredit-mode) | |
(add-hook 'cider-mode-hook 'rainbow-delimiters-mode) | |
(add-hook 'cider-repl-mode-hook 'company-mode) | |
(add-hook 'cider-repl-mode-hook 'paredit-mode) | |
(add-hook 'cider-repl-mode-hook 'rainbow-delimiters-mode) | |
;; Undo Starter Kit stuff that annoys me | |
;; See http://eschulte.github.io/emacs24-starter-kit/#starter-kit-core | |
(global-set-key (kbd "C-s") 'isearch-forward) | |
(global-set-key (kbd "C-r") 'isearch-backward) | |
(global-set-key (kbd "C-M-s") 'isearch-forward-regexp) | |
(global-set-key (kbd "C-M-r") 'isearch-backward-regexp) | |
(add-hook 'minibuffer-setup-hook (lambda () (paredit-mode 0))) | |
(remove-hook 'prog-mode-hook 'esk-turn-on-hl-line-mode) | |
(remove-hook 'prog-mode-hook 'esk-local-comment-auto-fill) | |
(remove-hook 'prog-mode-hook 'esk-pretty-lambdas) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment