Add bindings for modes that don't use insert state (#106)

This commit is contained in:
James Nguyen 2018-03-30 19:11:17 -07:00 committed by James N
parent b6acf98bb6
commit 2331fd54e2
4 changed files with 59 additions and 0 deletions

View File

@ -68,6 +68,7 @@
(evil-define-key 'normal ivy-occur-grep-mode-map
"d" 'ivy-occur-delete-candidate
(kbd "C-x C-q") 'ivy-wgrep-change-to-wgrep-mode
"i" 'ivy-wgrep-change-to-wgrep-mode
"gd" 'ivy-occur-delete-candidate
[mouse-1] 'ivy-occur-click
(kbd "<return>") 'ivy-occur-press-and-switch

48
evil-collection-wgrep.el Normal file
View File

@ -0,0 +1,48 @@
;;; evil-collection-wgrep.el --- Bindings for `wgrep' -*- lexical-binding: t -*-
;; Copyright (C) 2018 James Nguyen
;; Author: James Nguyen <james@jojojames.com>
;; Maintainer: James Nguyen <james@jojojames.com>
;; Pierre Neidhardt <ambrevar@gmail.com>
;; URL: https://github.com/emacs-evil/evil-collection
;; Version: 0.0.1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: evil, emacs, 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:
;;; Bindings for `wgrep'
;;; Code:
(require 'evil)
(require 'wgrep nil t)
(defvar wgrep-mode-map)
(defconst evil-colletion-wgrep-maps '(wgrep-mode-map))
(defun evil-collection-wgrep-setup ()
"Set up `evil' bindings for `wgrep'."
(evil-define-key nil wgrep-mode-map
[remap evil-write] 'wgrep-finish-edit)
(evil-define-key 'normal wgrep-mode-map
"ZQ" 'wgrep-abort-changes
"ZZ" 'wgrep-finish-edit
(kbd "<escape>") 'wgrep-exit))
(provide 'evil-collection-wgrep)
;;; evil-collection-wgrep.el ends here

View File

@ -147,6 +147,7 @@ or evil-collection.")
view
vlf
which-key
wgrep
woman
xref
(ztree ztree-diff))

View File

@ -385,6 +385,15 @@ definition".
- ~f10~ Step Over
- ~f11~ Step Into
- ~S-f11~ Step Out
*** Editable Buffers
For buffers where insert-state doesn't make sense but buffer can be edited,
(e.g. wdired or wgrep), pressing ~i~ will change into editable state.
When this editable state is turned on,
~ZQ~ will abort and clear any changes.
~ZZ~ will finish and save any changes.
~ESC~ will exit editable state.
** Key Translation
~evil-collection-translate-key~ allows binding a key to the definition of