Skip to content

Commit acb056b

Browse files
fredericgiquelcondy0919
authored andcommitted
magit: Separate mode for magit-repos
1 parent 7452430 commit acb056b

File tree

3 files changed

+50
-11
lines changed

3 files changed

+50
-11
lines changed

evil-collection.el

+1
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ See `evil-collection-init' and `evil-collection--modes-with-delayed-setup'."
252252
macrostep
253253
man
254254
(magit magit-submodule) ;; See https://github.com/emacs-evil/evil-collection/issues/637
255+
magit-repos
255256
magit-section
256257
magit-todos
257258
markdown-mode
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
;;; evil-collection-magit-repos.el --- Bindings for magit-repos -*- lexical-binding: t -*-
2+
3+
;; Copyright (C) 2015-2016, 2021 Justin Burkett
4+
5+
;; Author: Justin Burkett <[email protected]>
6+
;; Maintainer: Justin Burkett <[email protected]>
7+
;; James Nguyen <[email protected]>
8+
;; Pierre Neidhardt <[email protected]>
9+
;; Package-Requires: ((emacs "26.3") (evil "1.2.3") (magit "2.6.0"))
10+
;; Homepage: https://github.com/emacs-evil/evil-collection
11+
;; Version: 0.0.1
12+
13+
;; This file is free software; you can redistribute it and/or modify
14+
;; it under the terms of the GNU General Public License as published
15+
;; by the Free Software Foundation; either version 3, or (at your
16+
;; option) any later version.
17+
;;
18+
;; This file is distributed in the hope that it will be useful,
19+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
;; GNU General Public License for more details.
22+
;;
23+
;; For a full copy of the GNU General Public License
24+
;; see <http://www.gnu.org/licenses/>.
25+
26+
;;; Commentary:
27+
;;; Bindings for magit-repos.
28+
29+
;;; Code:
30+
(require 'evil-collection)
31+
(require 'magit-repos nil t)
32+
33+
(defvar magit-repolist-mode-map)
34+
(defconst evil-collection-magit-repos-maps '(magit-repolist-mode-map))
35+
36+
;;;###autoload
37+
(defun evil-collection-magit-repos-setup ()
38+
"Set up `evil' bindings for `magit-repos'."
39+
(evil-set-initial-state 'magit-repolist-mode 'normal)
40+
(evil-collection-define-key 'normal 'magit-repolist-mode-map
41+
"m" 'magit-repolist-mark
42+
"u" 'magit-repolist-unmark
43+
"f" 'magit-repolist-fetch
44+
(kbd "RET") 'magit-repolist-status
45+
(kbd "gr") 'magit-list-repositories)
46+
(add-hook 'magit-repolist-mode-hook 'evil-normalize-keymaps))
47+
48+
(provide 'evil-collection-magit-repos)
49+
;;; evil-collection-magit-repos.el ends here

modes/magit/evil-collection-magit.el

-11
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
(defvar magit-process-mode-map)
5151
(defvar magit-reflog-mode-map)
5252
(defvar magit-refs-mode-map)
53-
(defvar magit-repolist-mode-map)
5453
(defvar magit-status-mode-map)
5554
(defvar magit-submodule-list-mode-map)
5655

@@ -62,7 +61,6 @@
6261
magit-blame-read-only-mode-map
6362
magit-blob-mode-map
6463
magit-submodule-list-mode-map ; -> parent: `magit-repolist-mode-map'
65-
magit-repolist-mode-map
6664
magit-mode-map))
6765

6866
(defcustom evil-collection-magit-use-y-for-yank t
@@ -476,15 +474,6 @@ denotes the original magit key for this command.")
476474
;; Need to refresh evil keymaps when blame mode is entered.
477475
(add-hook 'magit-blame-mode-hook 'evil-normalize-keymaps)
478476

479-
(evil-set-initial-state 'magit-repolist-mode 'normal)
480-
(evil-collection-define-key 'normal 'magit-repolist-mode-map
481-
"m" 'magit-repolist-mark
482-
"u" 'magit-repolist-unmark
483-
"f" 'magit-repolist-fetch
484-
(kbd "RET") 'magit-repolist-status
485-
(kbd "gr") 'magit-list-repositories)
486-
(add-hook 'magit-repolist-mode-hook 'evil-normalize-keymaps)
487-
488477
(evil-set-initial-state 'magit-submodule-list-mode 'normal)
489478
(evil-collection-define-key 'normal 'magit-submodule-list-mode-map
490479
(kbd "RET") 'magit-repolist-status

0 commit comments

Comments
 (0)