Skip to content

Commit 978f18f

Browse files
committed
Control my own copy of evil-rebellion.
1 parent 4528d82 commit 978f18f

8 files changed

+1224
-0
lines changed

evil-rebellion/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*~
2+
*.elc
3+

evil-rebellion/COPYING

+674
Large diffs are not rendered by default.

evil-rebellion/README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Evil Rebellion
2+
3+
The aim of the evil rebellion is to get more emacs mode working in a way more
4+
in sync with default vi bindings. Its main focus is hence to define new
5+
keymaps. Rebellion adheres to well-defined conventions in its rebuilding of
6+
the emacs keybindings. This makes it simple to switch between editing using
7+
evil keybindings and other modes like buffer lists or magit revision control.
8+
9+
## Conventions
10+
11+
* Moving is always done using `hjkl`. However, `h` and `l` may be rebound if
12+
charwise moving doesn't make sense in a buffer.
13+
* Longer range jumps are commands prefixed by `g`.
14+
* Refresh is bound to `r`.
15+
* Quitting and hiding is bound to `q`.
16+
* Searching is done using `/`, `?`, `n` and `N`.
17+
* `d` is for *delete*
18+
* `o` is for *open*
19+
* `:` will always start `EX` mode – mode-specific comman evaluation is
20+
initialized using `;` where available.
21+
* Shift-key gives access to a different flavor of the command.
22+
23+
## License
24+
25+
The *evil rebellion* against inconsistent emacs key bindings.
26+
Copyright © 2013–2014 Albert Krewinkel
27+
28+
This program is free software: you can redistribute it and/or modify it under
29+
the terms of the GNU General Public License as published by the Free Software
30+
Foundation, either version 3 of the License, or (at your option) any later
31+
version.
32+
33+
This program is distributed in the hope that it will be useful, but WITHOUT
34+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
35+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
36+
details.
37+
38+
You should have received a copy of the GNU General Public License along with
39+
this program. If not, see <http://www.gnu.org/licenses/>.

evil-rebellion/evil-bbdb-rebellion.el

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
;;; evil-bbdb-rebellion.el --- Key-bindings for evil bbdb3 rebels
2+
3+
;; Copyright © 2013–2014 Albert Krewinkel
4+
;;
5+
;; Author: Albert Krewinkel <[email protected]>
6+
;; Keywords: evil bbdb rebellion
7+
;;
8+
;; This program is free software; you can redistribute it and/or modify
9+
;; it under the terms of the GNU General Public License as published by
10+
;; the Free Software Foundation, either version 3 of the License, or
11+
;; (at your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful,
14+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
;; GNU General Public License for more details.
17+
18+
;; This file is not part of GNU Emacs.
19+
20+
;; You should have received a copy of the GNU General Public License
21+
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
23+
;;; Code:
24+
25+
(evil-define-key 'motion bbdb-mode-map
26+
"\C-k" 'bbdb-delete-field-or-record
27+
"\C-x\C-s" 'bbdb-save
28+
"\C-x\C-t" 'bbdb-transpose-fields
29+
"\d" 'bbdb-prev-field ; DEL
30+
"\M-d" 'bbdb-dial
31+
"\t" 'bbdb-next-field ; TAB
32+
"+" 'bbdb-append-display
33+
"*" 'bbdb-do-all-records
34+
";" 'bbdb-edit-foo
35+
"?" 'bbdb-help
36+
"!" 'bbdb-search-invert
37+
"=" 'delete-other-windows
38+
"a" 'bbdb-add-mail-alias
39+
"A" 'bbdb-mail-aliases
40+
"C" 'bbdb-copy-records-as-kill
41+
"c" 'bbdb-create
42+
"d" 'bbdb-delete-field-or-record
43+
"e" 'bbdb-edit-field
44+
"h" 'bbdb-info
45+
"i" 'bbdb-insert-field
46+
"J" 'bbdb-next-field
47+
"j" 'bbdb-next-record
48+
"K" 'bbdb-prev-field
49+
"k" 'bbdb-prev-record
50+
"m" 'bbdb-mail
51+
"M" 'bbdb-mail-address
52+
"N" 'bbdb-next-field
53+
"n" 'bbdb-next-record
54+
"o" 'bbdb-omit-record
55+
"P" 'bbdb-prev-field
56+
"p" 'bbdb-prev-record
57+
"s" 'bbdb-save
58+
"T" 'bbdb-display-records-completely
59+
"t" 'bbdb-toggle-records-layout
60+
"u" 'bbdb-browse-url
61+
62+
;; Search keys
63+
"b" 'bbdb
64+
"/1" 'bbdb-display-records
65+
"/n" 'bbdb-search-name
66+
"/o" 'bbdb-search-organization
67+
"/p" 'bbdb-search-phone
68+
"/a" 'bbdb-search-address
69+
"/m" 'bbdb-search-mail
70+
"/N" 'bbdb-search-xfields
71+
"/x" 'bbdb-search-xfields
72+
"/c" 'bbdb-search-changed
73+
"/d" 'bbdb-search-duplicates
74+
"\C-xnw" 'bbdb-display-all-records
75+
"\C-xnd" 'bbdb-display-current-record
76+
)
77+
78+
(evil-set-initial-state 'bbdb-mode 'motion)
79+
80+
(provide 'evil-bbdb-rebellion)
+189
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
;;; evil-magit-rebellion.el --- Key-bindings for evil magit rebels
2+
3+
;; Copyright © 2013-2014 Albert Krewinkel
4+
;;
5+
;; Author: Albert Krewinkel <[email protected]>
6+
;; Keywords: evil magit rebellion
7+
;;
8+
;; This program is free software; you can redistribute it and/or modify
9+
;; it under the terms of the GNU General Public License as published by
10+
;; the Free Software Foundation, either version 3 of the License, or
11+
;; (at your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful,
14+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
;; GNU General Public License for more details.
17+
18+
;; This file is not part of GNU Emacs.
19+
20+
;; You should have received a copy of the GNU General Public License
21+
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
23+
;;; Code:
24+
25+
;; Start to insert mode when editing commit messages
26+
(evil-set-initial-state 'magit-log-edit-mode 'insert)
27+
(evil-set-initial-state 'git-commit-mode 'insert)
28+
29+
;; "1" 'magit-show-level-1
30+
;; "2" 'magit-show-level-2
31+
;; "3" 'magit-show-level-3
32+
;; "4" 'magit-show-level-4
33+
(evil-set-initial-state 'magit-mode 'motion)
34+
(evil-define-key 'motion magit-mode-map
35+
"\M-1" 'magit-show-level-1-all
36+
"\M-2" 'magit-show-level-2-all
37+
"\M-3" 'magit-show-level-3-all
38+
"\M-4" 'magit-show-level-4-all
39+
"\M-H" 'magit-show-only-files-all
40+
"\M-S" 'magit-show-level-4-all
41+
"\M-h" 'magit-show-only-files
42+
"\M-s" 'magit-show-level-4
43+
"!" 'magit-key-mode-popup-running
44+
"$" 'magit-process
45+
"+" 'magit-diff-larger-hunks
46+
"-" 'magit-diff-smaller-hunks
47+
"=" 'magit-diff-default-hunks
48+
"/" 'evil-search-forward
49+
":" 'evil-ex
50+
";" 'magit-git-command
51+
"?" 'evil-search-backward
52+
"<" 'magit-key-mode-popup-stashing
53+
"A" 'magit-cherry-pick-item
54+
"B" 'magit-key-mode-popup-bisecting
55+
;C commit add log
56+
"D" 'magit-revert-item
57+
"E" 'magit-ediff
58+
"F" 'magit-key-mode-popup-pulling
59+
"G" 'evil-goto-line
60+
"H" 'magit-rebase-step
61+
;I ignore item locally
62+
"J" 'magit-key-mode-popup-apply-mailbox
63+
"K" 'magit-key-mode-popup-dispatch
64+
"L" 'magit-add-change-log-entry
65+
"M" 'magit-key-mode-popup-remoting
66+
"N" 'evil-search-previous
67+
;O undefined
68+
"P" 'magit-key-mode-popup-pushing
69+
;Q undefined
70+
"R" 'magit-refresh-all
71+
"S" 'magit-stage-all
72+
;T change what branch tracks
73+
"U" 'magit-unstage-all
74+
;V visual line
75+
"W" 'magit-diff-working-tree
76+
"X" 'magit-reset-working-tree
77+
"Y" 'magit-interactive-rebase
78+
"Z" 'magit-key-mode-popup-stashing
79+
"a" 'magit-apply-item
80+
"b" 'magit-key-mode-popup-branching
81+
"c" 'magit-key-mode-popup-committing
82+
;d discard
83+
"e" 'magit-diff
84+
"f" 'magit-key-mode-popup-fetching
85+
"g?" 'magit-describe-item
86+
"g$" 'evil-end-of-visual-line
87+
"g0" 'evil-beginning-of-visual-line
88+
"gE" 'evil-backward-WORD-end
89+
"g^" 'evil-first-non-blank-of-visual-line
90+
"g_" 'evil-last-non-blank
91+
"gd" 'evil-goto-definition
92+
"ge" 'evil-backward-word-end
93+
"gg" 'evil-goto-first-line
94+
"gj" 'evil-next-visual-line
95+
"gk" 'evil-previous-visual-line
96+
"gm" 'evil-middle-of-visual-line
97+
"h" 'magit-key-mode-popup-rewriting
98+
;i ignore item
99+
"j" 'magit-goto-next-section
100+
"k" 'magit-goto-previous-section
101+
"l" 'magit-key-mode-popup-logging
102+
"m" 'magit-key-mode-popup-merging
103+
"n" 'evil-search-next
104+
"o" 'magit-key-mode-popup-submodule
105+
"p" 'magit-cherry
106+
"q" 'magit-mode-quit-window
107+
"r" 'magit-refresh
108+
;s stage
109+
"t" 'magit-key-mode-popup-tagging
110+
;u unstage
111+
"v" 'magit-revert-item
112+
"w" 'magit-wazzup
113+
"x" 'magit-reset-head
114+
"y" 'magit-copy-item-as-kill
115+
;z position current line
116+
" " 'magit-show-item-or-scroll-up
117+
"\d" 'magit-show-item-or-scroll-down
118+
"\t" 'magit-toggle-section
119+
(kbd "<return>") 'magit-visit-item
120+
(kbd "C-<return>") 'magit-dired-jump
121+
(kbd "<backtab>") 'magit-expand-collapse-section
122+
(kbd "C-x 4 a") 'magit-add-change-log-entry-other-window
123+
(kbd "\M-d") 'magit-copy-item-as-kill)
124+
125+
;;; Redefine some bindings if rigid key bindings are expected
126+
;(when magit-rigid-key-bindings
127+
; (evil-define-key 'motion magit-mode-map
128+
; "!" 'magit-git-command-topdir
129+
; "B" 'undefined
130+
; "F" 'magit-pull
131+
; "J" 'magit-apply-mailbox
132+
; "M" 'magit-branch-manager
133+
; "P" 'magit-push
134+
; "b" 'magit-checkout
135+
; "c" 'magit-commit
136+
; "f" 'magit-fetch-current
137+
; "h" 'undefined
138+
; "l" 'magit-log
139+
; "m" 'magit-merge
140+
; "o" 'magit-submodule-update
141+
; "t" 'magit-tag
142+
; "z" 'magit-stash))
143+
144+
(defun evil-magit-rebellion-quit-keymode ()
145+
(interactive)
146+
(magit-key-mode-command nil))
147+
148+
(evil-set-initial-state 'magit-commit-mode 'motion)
149+
(evil-define-key 'motion magit-commit-mode-map
150+
"\C-c\C-b" 'magit-show-commit-backward
151+
"\C-c\C-f" 'magit-show-commit-forward)
152+
153+
(evil-set-initial-state 'magit-status-mode 'motion)
154+
(evil-define-key 'motion magit-status-mode-map
155+
"\C-f" 'evil-scroll-page-down
156+
"\C-b" 'evil-scroll-page-up
157+
"." 'magit-mark-item
158+
"=" 'magit-diff-with-mark
159+
"C" 'magit-add-log
160+
"I" 'magit-ignore-item-locally
161+
"S" 'magit-stage-all
162+
"U" 'magit-unstage-all
163+
"X" 'magit-reset-working-tree
164+
"d" 'magit-discard-item
165+
"i" 'magit-ignore-item
166+
"s" 'magit-stage-item
167+
"u" 'magit-unstage-item
168+
"z" 'magit-key-mode-popup-stashing)
169+
170+
(evil-set-initial-state 'magit-log-mode 'motion)
171+
(evil-define-key 'motion magit-log-mode-map
172+
"." 'magit-mark-item
173+
"=" 'magit-diff-with-mark
174+
"e" 'magit-log-show-more-entries)
175+
176+
(evil-set-initial-state 'magit-wassup-mode 'motion)
177+
(evil-define-key 'motion magit-wazzup-mode-map
178+
"." 'magit-mark-item
179+
"=" 'magit-diff-with-mark
180+
"i" 'magit-ignore-item)
181+
182+
(evil-set-initial-state 'magit-branch-manager-mode 'motion)
183+
(evil-define-key 'motion magit-branch-manager-mode-map
184+
"d" 'magit-remove-branch
185+
"D" 'magit-remove-branch-in-remote-repo
186+
"v" 'magit-show-branches
187+
"T" 'magit-change-what-branch-tracks)
188+
189+
(provide 'evil-magit-rebellion)

0 commit comments

Comments
 (0)