2017-11-05 17:05:46 +01:00
|
|
|
;;; evil-ag.el --- Evil Bindings for Ag -*- lexical-binding: t -*-
|
|
|
|
|
|
|
|
;; Copyright (C) 2017 James Nguyen
|
|
|
|
|
|
|
|
;; Author: James Nguyen <james@jojojames.com>
|
|
|
|
;; Maintainer: James Nguyen <james@jojojames.com>
|
2017-11-07 11:04:12 +01:00
|
|
|
;; Pierre Neidhardt <ambrevar@gmail.com>
|
2017-11-05 17:05:46 +01:00
|
|
|
;; URL: https://github.com/jojojames/evil-collection
|
|
|
|
;; Version: 0.0.1
|
|
|
|
;; Package-Requires: ((emacs "25.1"))
|
|
|
|
;; Keywords: evil, ag, tools
|
|
|
|
|
|
|
|
;; 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
;;; Commentary:
|
2017-11-07 11:04:12 +01:00
|
|
|
;; Evil bindings for `ag-mode' from the `wgrep-ag' package.
|
2017-11-05 17:05:46 +01:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
(require 'ag)
|
|
|
|
(require 'evil)
|
|
|
|
|
2017-11-07 02:39:23 +01:00
|
|
|
(defun evil-ag-setup ()
|
2017-11-05 17:05:46 +01:00
|
|
|
(evil-add-hjkl-bindings ag-mode-map 'normal
|
|
|
|
"gg" #'evil-goto-first-line
|
|
|
|
"gr" #'recompile
|
|
|
|
"gj" #'compilation-next-error
|
|
|
|
"gk" #'compilation-previous-error
|
2017-11-11 22:31:26 +01:00
|
|
|
(kbd "C-j") #'compilation-next-error
|
|
|
|
(kbd "C-k") #'compilation-previous-error
|
2017-11-05 17:05:46 +01:00
|
|
|
"0" #'evil-digit-argument-or-evil-beginning-of-line
|
|
|
|
"n" #'evil-search-next
|
|
|
|
"N" #'evil-search-previous)
|
2017-11-07 03:02:21 +01:00
|
|
|
|
|
|
|
;; `ag' is best set in 'normal state because its buffer can be edited.
|
|
|
|
;; https://github.com/mhayashi1120/Emacs-wgrep
|
2017-11-05 17:36:05 +01:00
|
|
|
(evil-set-initial-state 'ag-mode 'normal))
|
2017-11-05 17:05:46 +01:00
|
|
|
|
|
|
|
(provide 'evil-ag)
|
|
|
|
;;; evil-ag.el ends here
|