Created
July 16, 2014 21:33
-
-
Save escherize/4c4745304a5fa5425378 to your computer and use it in GitHub Desktop.
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Bryan.el -- Bryan Maass's emacs cfgs | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; theme | |
(load-theme 'solarized-dark 't) | |
;; html stuff | |
(require 'web-mode) | |
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) | |
(add-hook 'web-mode-hook | |
(lambda () (local-set-key (kbd "RET") 'newline-and-indent))) | |
(add-hook 'web-mode-hook | |
(lambda () (local-set-key (kbd "{") 'paredit-open-curly))) | |
(add-hook 'clojure-mode-hook | |
(lambda() | |
(hl-line-mode -1) | |
(global-hl-line-mode -1)) | |
't | |
) | |
;; random bindings. | |
(global-set-key (kbd "M-p") 'backward-paragraph) | |
(global-set-key (kbd "M-n") 'forward-paragraph) | |
(global-set-key (kbd "C-x a r") 'align-regexp) | |
(global-set-key (kbd "M-x") 'smex) | |
(global-set-key (kbd "M-<") 'beginning-of-buffer) | |
(global-set-key (kbd "M->") 'end-of-buffer) | |
(global-set-key (kbd "M-f") 'forward-word) | |
(global-set-key (kbd "M-b") 'backward-word) | |
(global-set-key (kbd "M-SPC") 'just-one-space) | |
(global-set-key (kbd "M-%") 'query-replace) | |
(global-set-key (kbd "M-y") 'yank-pop) | |
(global-set-key (kbd "M-g g") 'goto-line) | |
(global-set-key (kbd "M-w") 'copy-region-as-kill) | |
(global-set-key (kbd "C-<right>") 'paredit-forward-slurp-sexp) | |
(global-set-key (kbd "C-<right>") 'paredit-backward-slurp-sexp) | |
(global-set-key (kbd "C-=") 'er/expand-region) | |
(global-set-key (kbd "C-x x") 'crosshairs) | |
(global-set-key (kbd "C->") 'mc/mark-next-like-this) | |
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) | |
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) | |
;; revert buffers automatically | |
(auto-revert-mode 1) | |
;; save #*# files in temp | |
(setq backup-directory-alist | |
`((".*" . ,temporary-file-directory))) | |
(setq auto-save-file-name-transforms | |
`((".*" ,temporary-file-directory t))) | |
;; remove C-] keybinding. (kbd fn does not work for this.) | |
(global-set-key "" nil) | |
;; cider + acnrepl stuff. ooh, fancy. see: https://github.com/clojure-emacs/ac-nrepl | |
(require 'ac-nrepl) | |
(add-hook 'cider-repl-mode-hook 'ac-nrepl-setup) | |
(add-hook 'cider-mode-hook 'ac-nrepl-setup) | |
(eval-after-load "auto-complete" | |
'(add-to-list 'ac-modes 'cider-repl-mode)) | |
(defun set-auto-complete-as-completion-at-point-function () | |
(setq completion-at-point-functions '(auto-complete))) | |
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function) | |
(add-hook 'cider-repl-mode-hook 'set-auto-complete-as-completion-at-point-function) | |
(add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function) | |
(eval-after-load "cider" | |
'(define-key cider-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc)) | |
;; custom cider stuff. see: https://github.com/clojure-emacs/cider | |
(add-hook 'cider-repl-mode-hook 'paredit-mode) | |
(add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode) | |
(setq nrepl-hide-special-buffers t) | |
(setq cider-popup-stacktraces nil) | |
(setq nrepl-buffer-name-show-port t) | |
(setq cider-prompt-save-file-on-load nil) | |
(setq cider-repl-history-size 1000) | |
(setq cider-repl-history-file "~/.emacs.d/cider_repl_hist.txt") | |
(defun cljlet-buffer () | |
(save-excursion | |
(goto-char (point-min)) ;;start at top. | |
(while (/= (point) (point-max)) | |
(progn (ignore-errors (align-cljlet)) | |
(next-line) | |
(beginning-of-line))))) | |
;; indent + align-cljlet with M-q | |
(defun bry-indent-buffer () | |
"Indent the currently visited buffer." | |
(interactive) | |
(indent-region (point-min) (point-max)) | |
(untabify (point-min) (point-max)) | |
(delete-trailing-whitespace) | |
;;(align-cljlet) ;; align-cljlet at point | |
;;(cljlet-buffer) ;; align-cljlet all | |
) | |
(global-set-key (kbd "M-q") 'bry-indent-buffer) | |
;; and remove the goddamn paredit M-q paredit keybinding ^^ | |
(when (fboundp 'paredit-mode-map) | |
(eval-after-load 'paredit | |
(define-key paredit-mode-map (kbd "M-q") nil))) | |
(progn | |
(setq global-highlight-parentheses-mode 't) | |
(setq hl-paren-colors | |
'( "#eee8d5" "#eee8d5" "#073642" "#073642" "#073642" | |
"#eee8d5" "#eee8d5" "#eee8d5" "#eee8d5" "#eee8d5" | |
"#eee8d5" "#eee8d5" "#eee8d5" "#eee8d5" "#eee8d5")) | |
(setq hl-paren-background-colors | |
'( "#d33682" "#dc322f" "#b58900" "#859900" "#2aa198" | |
"#268bd2" "#6c71c4" "#6c71c4" "#6c71c4" "#6c71c4" | |
"#6c71c4" "#6c71c4" "#6c71c4" "#6c71c4" "#6c71c4")) | |
(define-globalized-minor-mode global-highlight-parentheses-mode | |
highlight-parentheses-mode | |
(lambda () | |
(highlight-parentheses-mode t))) | |
(global-highlight-parentheses-mode t)) | |
;; default mc keybindings | |
(global-set-key (kbd "C->") 'mc/mark-next-like-this) | |
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) | |
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) | |
;; ido everywhere | |
(setq ido-everywhere t) | |
;; Display ido results vertically, rather than horizontally | |
(setq ido-decorations (quote ("\n-> " | |
"" | |
"\n " | |
"\n ..." | |
"[" "]" | |
" [No match]" | |
" [Matched]" | |
" [Not readable]" | |
" [Too big]" | |
" [Confirm]"))) | |
;; Navigate ido-mode vertically | |
(add-hook 'ido-setup-hook | |
(lambda () | |
(define-key ido-completion-map [down] 'ido-next-match) | |
(define-key ido-completion-map [up] 'ido-prev-match) | |
(define-key ido-completion-map (kbd "C-n") 'ido-next-match) | |
(define-key ido-completion-map (kbd "C-p") 'ido-prev-match))) | |
;; Always show line numbers on left | |
(global-linum-mode t) | |
;; Line numbers gutter should be five characters wide | |
(setq linum-format "%4d |") | |
;; Mode line shows line numbers | |
(line-number-mode 1) | |
;; Tab width of 2 | |
(setq-default tab-width 2) | |
;; uhhh. align clojure lets | |
(require 'align-cljlet) | |
;; highlight undo, etc | |
(require 'volatile-highlights) | |
(volatile-highlights-mode t) | |
;; projectile mode all the things | |
(projectile-global-mode) | |
;; paredit all the things | |
(require 'paredit-everywhere) | |
(add-hook 'prog-mode-hook 'paredit-everywhere-mode) | |
;; rgrep binding | |
(global-set-key (kbd "M-g r") 'rgrep) | |
(highlight-symbol-mode t) | |
(hl-line-mode 0) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment