2015-05-07 03:19:24 -04:00
|
|
|
(use-package hl-todo
|
|
|
|
:defer t
|
|
|
|
:init (add-hook 'after-change-major-mode-hook 'hl-todo-mode))
|
|
|
|
|
2014-12-10 15:54:36 -05:00
|
|
|
(use-package dash-at-point
|
|
|
|
:if is-mac
|
|
|
|
:commands (dash-at-point dash-at-point-with-docset))
|
|
|
|
|
|
|
|
(use-package rainbow-delimiters
|
|
|
|
:commands rainbow-delimiters-mode
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(setq rainbow-delimiters-outermost-only-face-count 1)
|
|
|
|
(set-face-attribute 'rainbow-delimiters-depth-1-face nil
|
|
|
|
:foreground 'unspecified
|
|
|
|
:inherit 'my-outermost-paren-face))
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
|
2015-04-27 23:25:50 -04:00
|
|
|
(add-hook 'js2-mode-hook 'rainbow-delimiters-mode)
|
|
|
|
(add-hook 'scss-mode-hook 'rainbow-delimiters-mode)))
|
2014-12-10 15:54:36 -05:00
|
|
|
|
|
|
|
;;; Config modes
|
|
|
|
(use-package yaml-mode
|
|
|
|
:defer t
|
|
|
|
:config (add-hook 'yaml-mode-hook 'enable-tab-width-2))
|
|
|
|
|
|
|
|
(use-package emr
|
|
|
|
:commands (emr-initialize emr-show-refactor-menu)
|
2015-05-07 03:19:24 -04:00
|
|
|
:init (add-hook 'prog-mode-hook 'emr-initialize)
|
|
|
|
:config (bind popup-menu-keymap [escape] 'keyboard-quit))
|
2014-12-10 15:54:36 -05:00
|
|
|
|
2015-05-03 01:48:37 -04:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Code building
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2015-05-08 03:03:38 -04:00
|
|
|
(defvar my-build-command '("make %s" . "Makefile"))
|
2015-04-27 23:25:50 -04:00
|
|
|
(make-variable-buffer-local 'my-build-command)
|
2015-05-08 03:03:38 -04:00
|
|
|
|
|
|
|
(defun set-build-command (command &optional file)
|
2015-05-09 18:08:12 -04:00
|
|
|
(when (or (null file)
|
|
|
|
(project-has-files file))
|
|
|
|
(setq my-build-command `(,command . ,file))))
|
2015-04-27 23:25:50 -04:00
|
|
|
|
|
|
|
(evil-define-command my:build (arg)
|
|
|
|
"Call a build command in the current directory.
|
|
|
|
If ARG is nil this function calls `recompile', otherwise it calls
|
|
|
|
`compile' passing ARG as build command."
|
|
|
|
(interactive "<sh>")
|
2015-05-08 03:03:38 -04:00
|
|
|
(when (null my-build-command)
|
|
|
|
(user-error "No build command was set"))
|
|
|
|
(let ((build-file (cdr my-build-command))
|
|
|
|
(build-cmd (car my-build-command)))
|
|
|
|
(if (project-has-files build-file)
|
|
|
|
(compile (format "cd '%s' && %s" build-file (format build-cmd (or arg ""))))
|
2015-04-27 23:25:50 -04:00
|
|
|
(error "Could not find Makefile"))))
|
2014-12-10 15:54:36 -05:00
|
|
|
|
2015-05-03 01:48:37 -04:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Code running
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(evil-define-operator my:eval-region (beg end)
|
|
|
|
:move-point nil
|
|
|
|
(interactive "<r>")
|
2015-05-07 03:19:24 -04:00
|
|
|
(cond ((eq major-mode 'emacs-lisp-mode)
|
|
|
|
(eval-region beg end))
|
|
|
|
(t
|
2015-05-14 23:50:20 -04:00
|
|
|
(let ((interp (my--get-interpreter))
|
|
|
|
(max-mini-window-height 1))
|
2015-05-07 03:19:24 -04:00
|
|
|
(when interp (shell-command-on-region beg end interp))))))
|
2015-05-03 01:48:37 -04:00
|
|
|
|
|
|
|
(evil-define-command my:eval-buffer ()
|
|
|
|
(interactive)
|
2015-05-07 03:19:24 -04:00
|
|
|
(cond ((eq major-mode 'emacs-lisp-mode)
|
|
|
|
(eval-buffer))
|
|
|
|
(t
|
2015-05-14 23:50:20 -04:00
|
|
|
(let ((interp (my--get-interpreter))
|
|
|
|
(max-mini-window-height 1))
|
2015-05-07 03:19:24 -04:00
|
|
|
(when interp (shell-command-on-region (point-min) (point-max) interp))))))
|
2015-05-03 01:48:37 -04:00
|
|
|
|
2015-05-07 03:19:24 -04:00
|
|
|
(defun my--get-interpreter ()
|
2015-05-03 01:48:37 -04:00
|
|
|
(car (--first (eq (cdr it) major-mode) interpreter-mode-alist)))
|
|
|
|
|
2014-12-10 15:54:36 -05:00
|
|
|
(provide 'init-dev)
|
|
|
|
;;; init-dev.el ends here
|