evil-collection/evil-collection-ztree.el

74 lines
2.2 KiB
EmacsLisp
Raw Normal View History

2017-12-07 02:41:09 +01:00
;;; evil-collection-ztree.el --- Evil bindings for ztree -*- lexical-binding: t -*-
2017-11-06 17:53:44 +01:00
;; Copyright (C) 2017 Pierre Neidhardt
2018-08-27 10:41:51 +02:00
;; Author: Pierre Neidhardt <mail@ambrevar.xyz>
;; Maintainer: James Nguyen <james@jojojames.com>, Pierre Neidhardt <mail@ambrevar.xyz>
2018-03-02 02:22:38 +01:00
;; URL: https://github.com/emacs-evil/evil-collection
2017-11-06 17:53:44 +01:00
;; Version: 0.0.1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: evil, ztree, tools
2017-11-06 17:53:44 +01:00
;; This file 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, or (at your
;; option) any later version.
;;
;; This file 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.
;;
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;;; Commentary:
2017-11-07 10:53:13 +01:00
;; Evil bindings for ztree.
2017-11-06 17:53:44 +01:00
;;; Code:
(require 'evil-collection)
(require 'ztree nil t)
2017-11-06 17:53:44 +01:00
2018-02-25 02:14:05 +01:00
(defvar ztree-mode-map)
(defvar ztreediff-mode-map)
(defconst evil-collection-ztree-maps '(ztree-mode-map ztreediff-mode-map))
;;;###autoload
2017-12-07 02:41:09 +01:00
(defun evil-collection-ztree-setup ()
"Set up `evil' bindings for `ztree'."
2017-11-06 17:53:44 +01:00
(evil-collection-inhibit-insert-state 'ztree-mode-map)
2018-02-22 18:24:29 +01:00
(evil-set-initial-state 'ztree-mode 'normal)
(evil-collection-define-key 'normal 'ztree-mode-map
2017-11-07 10:53:13 +01:00
(kbd "<tab>") 'ztree-jump-side
2019-06-06 08:03:54 +02:00
(kbd "RET") 'ztree-perform-action
2017-11-07 10:53:13 +01:00
(kbd "SPC") 'ztree-perform-soft-action
2017-11-06 17:53:44 +01:00
2017-11-07 10:53:13 +01:00
"x" 'ztree-toggle-expand-subtree
2017-11-06 17:53:44 +01:00
;; refresh
2017-11-07 10:53:13 +01:00
"gr" 'ztree-refresh-buffer
2017-11-06 17:53:44 +01:00
2017-11-07 10:53:13 +01:00
;; quit
"q" 'quit-window
"ZQ" 'quit-window
"ZZ" 'quit-window)
2017-11-06 17:53:44 +01:00
(evil-collection-inhibit-insert-state 'ztreediff-mode-map)
2018-02-22 18:24:29 +01:00
(evil-set-initial-state 'ztree-mode 'normal)
(evil-define-minor-mode-key 'normal 'ztreediff-mode
2017-11-07 10:53:13 +01:00
"C" 'ztree-diff-copy
"D" 'ztree-diff-delete-file
"zH" 'ztree-diff-toggle-show-filtered-files
"d" 'ztree-diff-simple-diff-files
"zh" 'ztree-diff-toggle-show-equal-files
"gf" 'ztree-diff-view-file
2017-11-06 17:53:44 +01:00
;; refresh
2017-11-07 10:53:13 +01:00
"gr" 'ztree-diff-partial-rescan
"gR" 'ztree-diff-full-rescan))
2017-11-06 17:53:44 +01:00
2017-12-07 02:41:09 +01:00
(provide 'evil-collection-ztree)
;;; evil-collection-ztree.el ends here