From 933da1ab510cc4367d8570c1442c3ca15a112de7 Mon Sep 17 00:00:00 2001 From: James Nguyen Date: Sun, 5 Nov 2017 08:05:46 -0800 Subject: [PATCH] Add evil-ag to kickstart things --- evil-ag.el | 50 ++++++++++++++++++++++++++++++++++++++++++++ evil-collection.el | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 evil-ag.el create mode 100644 evil-collection.el diff --git a/evil-ag.el b/evil-ag.el new file mode 100644 index 0000000..1b924a2 --- /dev/null +++ b/evil-ag.el @@ -0,0 +1,50 @@ +;;; evil-ag.el --- Evil Bindings for Ag -*- 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, ag, 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 `ag-mode' when using +;; `evil-mode'. + +;;; Code: +(require 'ag) +(require 'evil) + +(defun evil-ag-set-keys () + (evil-add-hjkl-bindings ag-mode-map 'normal + "gg" #'evil-goto-first-line + "gr" #'recompile + "gj" #'compilation-next-error + "gk" #'compilation-previous-error + "\C-j" #'compilation-next-error + "\C-k" #'compilation-previous-error + "0" #'evil-digit-argument-or-evil-beginning-of-line + "n" #'evil-search-next + "N" #'evil-search-previous) + + (setq evil-motion-state-modes + (delete 'ag-mode evil-motion-state-modes))) + +(provide 'evil-ag) +;;; evil-ag.el ends here diff --git a/evil-collection.el b/evil-collection.el new file mode 100644 index 0000000..44c4828 --- /dev/null +++ b/evil-collection.el @@ -0,0 +1,52 @@ +;;; evil-collection.el --- A set of keybindings for evil-mode. -*- 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, emacs +;; 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: +;;; A set of keybindings for evil-mode. + +;;; Code: + +;;;###autoload +(defun evil-collection-builtin-modes-init () + "" + (interactive)) + +;;;###autoload +(defun evil-collection-extra-modes-init () + "" + (interactive) + (with-eval-after-load 'ag + (require 'evil-ag) + (evil-ag-set-keys))) + +;;;###autoload +(defun evil-collection-all-modes-init () + "Register Evil bindings for all supported modes." + (interactive) + (evil-collection-builtin-modes-init) + (evil-collection-extra-modes-init)) + +(provide 'evil-collection) +;;; evil-collection.el ends here