-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandy-mode-yh.el
58 lines (48 loc) · 1.76 KB
/
handy-mode-yh.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
;; handy-mode
;; Copyright (C) 2015-2019 David Capello
(defun handy-isearch-hook ()
;; Overriden:
;; M-n isearch-ring-advance
;; M-p isearch-ring-retreat
(handy-define-keys
isearch-mode-map
"M-n" 'isearch-abort
"M-y" 'isearch-repeat-forward
"M-Y" 'isearch-repeat-backward
"M-v" 'isearch-yank-kill
"M-w" 'handy-isearch-yank-sexp))
(defvar handy-mode-yh-map
(handy-make-keymap
"M-h" 'handy-beginning-of-line-and-buffer
"M-H" 'handy-end-of-line-and-buffer
"M-y" 'isearch-forward ; replaces yank
"M-Y" 'isearch-backward ; replaces yank
))
(define-minor-mode handy-mode-yh
"Enable Alt+YH keys.
.-----.-----.-----.-----.
| Y | | | |
| |-----' '-----|
| H | |
.-----------------------------|-----'-----------------'
| | |
'-----------. '-----------|
| |
'-----------------------------'
You can press M-h one time to go to the beginning of line, and a
second time to go to the beginning of buffer. The same with M-H
and end of line/buffer.
M-y : `isearch-forward'
M-h : `handy-beginning-of-line-and-buffer'
M-Y : `isearch-backward'
M-H : `handy-end-of-line-and-buffer'
Overridden keybindings:
M-y : `yank-pop' Use `M-Y' from `handy-mode-zb'
M-h : `mark-paragraph' Use `M-m SPC' from `handy-mode-nm'
"
:global t
:group 'handy-mode
:keymap handy-mode-yh-map
(if handy-mode-yh
(add-hook 'isearch-mode-hook 'handy-isearch-hook)
(remove-hook 'isearch-mode-hook 'handy-isearch-hook)))