2016-03-31 14:37:52 -04:00
|
|
|
;;; macros-evil.el
|
|
|
|
|
2016-05-29 14:12:53 -04:00
|
|
|
;;;###autoload
|
|
|
|
(defsubst def-text-obj! (key inner-fn &optional outer-fn)
|
|
|
|
(define-key evil-inner-text-objects-map key inner-fn)
|
|
|
|
(define-key evil-outer-text-objects-map key (or outer-fn inner-fn)))
|
|
|
|
|
2016-03-31 14:37:52 -04:00
|
|
|
;;;###autoload
|
2016-04-23 22:08:46 -04:00
|
|
|
(defmacro def-tmp-excmd! (cmd-on cmd-off &rest commands)
|
2016-05-12 02:53:31 -04:00
|
|
|
"Creates a toggle for a set of ex commands, named CMD-ON and CMD-OFF."
|
2016-03-31 14:37:52 -04:00
|
|
|
(declare (indent 2))
|
|
|
|
`(progn
|
|
|
|
(defun ,cmd-on (&rest _)
|
|
|
|
(mapc (lambda (cmd) (evil-ex-define-cmd (car cmd) (cdr cmd)))
|
|
|
|
',commands))
|
|
|
|
(defun ,cmd-off (&rest _)
|
2016-05-20 22:37:30 -04:00
|
|
|
(mapc (lambda (cmd) (doom/evil-ex-undefine-cmd (car cmd)))
|
2016-03-31 14:37:52 -04:00
|
|
|
',commands))))
|
|
|
|
|
2016-04-19 22:17:03 -04:00
|
|
|
;; Shortcuts for the evil expression register
|
|
|
|
;;;###autoload
|
2016-05-12 02:53:31 -04:00
|
|
|
(defmacro $= (str &rest args) `(calc-eval (format ,str ,@args)))
|
2016-04-19 22:17:03 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
2016-05-12 02:53:31 -04:00
|
|
|
(defmacro $r (char) `(evil-get-register ,char))
|
2016-04-19 22:17:03 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
2016-05-12 02:53:31 -04:00
|
|
|
(defmacro $expand (path) `(evil-ex-replace-special-filenames ,path))
|
2016-04-19 22:17:03 -04:00
|
|
|
|
2016-03-31 14:37:52 -04:00
|
|
|
(provide 'macros-evil)
|
|
|
|
;;; macros-evil.el ends here
|