From 04a3e5c85977b05ca9d36535cfbd224917eac0bb Mon Sep 17 00:00:00 2001 From: James Nguyen Date: Wed, 29 Aug 2018 22:00:04 -0700 Subject: [PATCH] Add more support for vc modes --- evil-collection-vc-dir.el | 112 ++++++++++++++++++++++++++++++++++++++ evil-collection-vc-git.el | 40 ++++++++++++++ evil-collection.el | 2 + 3 files changed, 154 insertions(+) create mode 100644 evil-collection-vc-dir.el create mode 100644 evil-collection-vc-git.el diff --git a/evil-collection-vc-dir.el b/evil-collection-vc-dir.el new file mode 100644 index 0000000..11562e0 --- /dev/null +++ b/evil-collection-vc-dir.el @@ -0,0 +1,112 @@ +;;; evil-collection-vc-dir.el --- Evil bindings for Vc-Dir -*- lexical-binding: t -*- + +;; Copyright (C) 2017 James Nguyen + +;; Author: James Nguyen +;; Maintainer: James Nguyen +;; Pierre Neidhardt +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, vc-dir, 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 . + +;;; Commentary: +;; Evil bindings for Vc-Dir. + +;;; Code: +(require 'vc-dir) +(require 'evil-collection) + +(defconst evil-collection-vc-dir-maps '(vc-dir-mode-map)) + +(defun evil-collection-vc-dir-setup () + "Set up `evil' bindings for `vc-dir'." + (evil-set-initial-state 'vc-dir-mode 'normal) + (evil-collection-define-key 'normal 'vc-dir-mode-map + ;; VC commands + "n" 'vc-next-action + + "d" 'vc-diff + "D" 'vc-root-diff + + "R" 'vc-register + "s" 'vc-register ;; Like `magit-stage'? + "gu" 'vc-update + "gr" 'revert-buffer + + "p" 'vc-push + "P" 'vc-push + + "Ll" 'vc-print-log + "Lr" 'vc-print-root-log + "LL" 'vc-print-root-log + "Li" 'vc-log-incoming + "Lo" 'vc-log-outgoing + + "x" 'vc-revert + "b" 'vc-annotate ;; Like `magit-blame' + + ;; Marking. + "m" 'vc-dir-mark + "M" 'vc-dir-mark-all-files + "u" 'vc-dir-unmark + "U" 'vc-dir-unmark-all-files + + ;; Movement. + "j" 'vc-dir-next-line + "\t" 'vc-dir-next-directory + "k" 'vc-dir-previous-line + [backtab] 'vc-dir-previous-directory + + ;; Rebind paragraph-movement commands. + "]" 'vc-dir-next-directory + "[" 'vc-dir-previous-directory + "gj" 'vc-dir-next-directory + "gk" 'vc-dir-previous-directory + (kbd "C-j") 'vc-dir-next-directory + (kbd "C-k") 'vc-dir-previous-directory + + ;; The remainder. + "gf" 'vc-dir-find-file + "\C-m" 'vc-dir-find-file + + (kbd "S-") 'vc-dir-find-file-other-window + "gO" 'vc-dir-find-file-other-window + (kbd "M-") 'vc-dir-display-file + + "\C-c\C-c" 'vc-dir-kill-dir-status-process + [down-mouse-3] 'vc-dir-menu + [mouse-2] 'vc-dir-find-file-other-window + "t" 'vc-dir-toggle-mark + [follow-link] 'mouse-face + + "(" 'vc-dir-hide-up-to-date + "o" 'vc-dir-hide-up-to-date + + "X" 'vc-dir-kill-line + "S" 'vc-dir-search + "Q" 'vc-dir-query-replace-regexp + (kbd "M-s a C-s") 'vc-dir-isearch + (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp + "i" 'vc-dir-ignore + + ;; Branching + "Bc" 'vc-create-tag + "Bl" 'vc-print-branch-log + "Bs" 'vc-retrieve-tag)) + +(provide 'evil-collection-vc-dir) +;;; evil-collection-vc-dir.el ends here diff --git a/evil-collection-vc-git.el b/evil-collection-vc-git.el new file mode 100644 index 0000000..b556561 --- /dev/null +++ b/evil-collection-vc-git.el @@ -0,0 +1,40 @@ +;;; evil-collection-vc-git.el --- Evil bindings for Vc-Git -*- lexical-binding: t -*- + +;; Copyright (C) 2017 James Nguyen + +;; Author: James Nguyen +;; Maintainer: James Nguyen +;; Pierre Neidhardt +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, vc-git, 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 . + +;;; Commentary: +;; Evil bindings for Vc-Git. + +;;; Code: +(require 'vc-git) +(require 'evil-collection) + +(defconst evil-collection-vc-git-maps '(vc-git-mode-map)) + +(defun evil-collection-vc-git-setup () + "Set up `evil' bindings for `vc-git'." + (evil-set-initial-state 'vc-git-log-view-mode 'normal)) + +(provide 'evil-collection-vc-git) +;;; evil-collection-vc-git.el ends here diff --git a/evil-collection.el b/evil-collection.el index a79d3b1..72932b1 100644 --- a/evil-collection.el +++ b/evil-collection.el @@ -160,6 +160,8 @@ or evil-collection.") transmission typescript-mode vc-annotate + vc-dir + vc-git vdiff view vlf