Skip to content

Instantly share code, notes, and snippets.

@thickey
Forked from martintrojer/init.el
Last active August 29, 2015 14:07
Show Gist options
  • Save thickey/8c70e57de1dd9d1b3ef8 to your computer and use it in GitHub Desktop.
Save thickey/8c70e57de1dd9d1b3ef8 to your computer and use it in GitHub Desktop.
;; Clojure
(require 'clojure-mode)
(setq auto-mode-alist (cons '("\\.cljs$" . clojure-mode) auto-mode-alist))
(setq inferior-lisp-program "lein repl")
;; clj-refactor
(require 'clj-refactor)
(add-hook 'clojure-mode-hook (lambda ()
(clj-refactor-mode 1)
(cljr-add-keybindings-with-prefix "C-c C-o")))
;; align-cljlet
(require 'align-cljlet)
(global-set-key (kbd "C-c C-a") 'align-cljlet)
;; paredit
(require 'paredit)
(add-hook 'clojure-mode-hook 'paredit-mode)
;; projectile
(require 'projectile)
(setq projectile-mode-line '(:eval (format " P[%s]" (projectile-project-name))))
(add-hook 'clojure-mode-hook 'projectile-mode)
;; company-mode
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(require 'company-etags)
(add-to-list 'company-etags-modes 'clojure-mode)
;; yasnippet
(require 'yasnippet)
(diminish 'yas-minor-mode " Y")
(require 'clojure-snippets)
(yas-global-mode 1)
(add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets")
(yas-load-directory "~/.emacs.d/snippets")
;; Some handly key bindings
(global-set-key (kbd "C-c C-s") 'clojure-toggle-keyword-string)
(add-hook 'clojure-mode-hook
'(lambda ()
(define-key clojure-mode-map
"\C-c\C-k"
'(lambda ()
(interactive)
(let ((current-point (point)))
(goto-char (point-min))
(let ((ns-idx (re-search-forward clojure-namespace-name-regex nil t)))
(when ns-idx
(goto-char ns-idx)
(let ((sym (symbol-at-point)))
(message (format "Loading %s ..." sym))
(lisp-eval-string (format "(require '%s :reload)" sym))
(lisp-eval-string (format "(in-ns '%s)" sym)))))
(goto-char current-point))))))
(add-hook 'inferior-lisp-mode-hook
'(lambda ()
(define-key inferior-lisp-mode-map
"\C-cl"
'(lambda ()
(interactive)
(erase-buffer)
(lisp-eval-string "")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment