Add evil-occur

This commit is contained in:
James Nguyen 2017-11-05 09:22:10 -08:00
parent a2e8d82526
commit c70681004f
2 changed files with 74 additions and 1 deletions

View File

@ -46,7 +46,16 @@
(evil-edebug-set-keys))
(with-eval-after-load 'ibuffer
(require 'evil-ibuffer)
(evil-ibuffer-set-keys)))
(evil-ibuffer-set-keys))
(if (<= emacs-major-version 25)
(progn
(require 'evil-occur)
(evil-occur-set-keys))
(with-eval-after-load 'replace
(require 'evil-occur)
(evil-occur-set-keys)))
)
;;;###autoload
(defun evil-collection-extra-modes-init ()

64
evil-occur.el Normal file
View File

@ -0,0 +1,64 @@
;;; evil-occur.el --- Evil integration for occur. -*- lexical-binding: t -*-
;; Copyright (C) 2017 James Nguyen
;; Author: James Nguyen <james@jojojames.com>
;; Maintainer: James Nguyen <james@jojojames.com>
;; URL: https://github.com/jojojames/evil-collection
;; Version: 0.0.1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: evil, occur, 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Evil integration for `occur'.
;;; Code:
(require 'evil-collection-util)
(when (> emacs-major-version 25)
(require 'replace))
(defun evil-occur-set-keys ()
(setq evil-emacs-state-modes
(remove 'occur-mode evil-emacs-state-modes))
(evil-define-key 'normal occur-mode-map
;; Like `wdired-mode'.
"\C-x\C-q" 'occur-edit-mode
[mouse-2] 'occur-mode-mouse-goto
"\C-c\C-c" 'occur-mode-goto-occurrence
"\C-m" 'occur-mode-goto-occurrence
"o" 'occur-mode-goto-occurrence-other-window
"\C-o" 'occur-mode-display-occurrence
"\C-j" 'occur-next
"\C-k" 'occur-prev
"r" 'occur-rename-buffer
"c" 'clone-buffer
"\C-c\C-f" 'next-error-follow-minor-mode)
(evil-define-key 'normal occur-edit-mode-map
;; Like `wdired-mode'.
"\C-x\C-q" 'occur-cease-edit
[mouse-2] 'occur-mode-mouse-goto
"\C-c\C-c" 'occur-cease-edit
"\C-o" 'occur-mode-display-occurrence
"\C-c\C-f" 'next-error-follow-minor-mode))
(provide 'evil-occur)
;;; evil-occur.el ends here