diff --git a/evil-collection.el b/evil-collection.el index 4b21257..10911c1 100644 --- a/evil-collection.el +++ b/evil-collection.el @@ -69,7 +69,10 @@ (evil-ggtags-set-keys)) (with-eval-after-load 'ivy (require 'evil-ivy) - (evil-ivy-set-keys))) + (evil-ivy-set-keys)) + (with-eval-after-load 'macrostep + (require 'evil-macrostep) + (evil-collection-set-keys))) ;;;###autoload (defun evil-collection-all-modes-init () diff --git a/evil-macrostep.el b/evil-macrostep.el new file mode 100644 index 0000000..245962a --- /dev/null +++ b/evil-macrostep.el @@ -0,0 +1,47 @@ +;;; evil-macrostep.el --- Evil Integration for Macrostep -*- lexical-binding: t -*- + +;; Copyright (C) 2017 James Nguyen + +;; Author: James Nguyen +;; Maintainer: James Nguyen +;; URL: https://github.com/jojojames/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, macrostep, tools +;; HomePage: https://github.com/jojojames/evil-collection + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: +;; This package provides a sane set of defaults for `macrostep-mode' when using +;; `evil-mode'. +(require 'evil-collection-util) +(require 'macrostep) + +(defun evil-collection-set-keys () + ;; Keymaps don't seem to be populated on first try. + ;; Force `evil' to normalize keymaps. + (add-hook 'macrostep-mode-hook #'evil-normalize-keymaps) + + (evil-define-key 'normal macrostep-keymap + "q" 'macrostep-collapse-all + "e" 'macrostep-expand + "u" 'macrostep-collapse + "gj" 'macrostep-next-macro + "gk" 'macrostep-prev-macro + "C-j" 'macrostep-next-macro + "C-k" 'macrostep-prev-macro)) + +(provide 'evil-macrostep) +;;; evil-macrostep.el ends here