-
Notifications
You must be signed in to change notification settings - Fork 0
/
scamx-isearch.el
72 lines (63 loc) · 2.15 KB
/
scamx-isearch.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(use-package isearch
:custom
(isearch-repeat-on-direction-change t)
:config
;; face
(custom-set-faces
'(isearch ((t (:foreground "pink" :background "black" :weight bold :underline t))))
'(lazy-highlight ((t (:foreground "#67B7A4" :background "#0d0d0d")))))
;; exit
(defun isearch-exit-at-once ()
"Exit search normally without nonincremental search if no input is given."
(interactive)
(isearch-done)
(isearch-clean-overlays))
(define-key isearch-mode-map (kbd "<return>") 'isearch-exit-at-once))
(defvar meow-isearch-state-keymap
(let ((keymap (make-keymap)))
(suppress-keymap keymap t)
(define-key keymap [remap kmacro-start-macro] #'meow-start-kmacro)
(define-key keymap [remap kmacro-start-macro-or-insert-counter] #'meow-start-kmacro-or-insert-counter)
(define-key keymap [remap kmacro-end-or-call-macro] #'meow-end-or-call-kmacro)
(define-key keymap [remap kmacro-end-macro] #'meow-end-kmacro)
keymap)
"Keymap for Meow isearch state.")
(defface meow-isearch-cursor
'((((class color) (background dark))
(:inherit cursor))
(((class color) (background light))
(:inherit cursor)))
"Convert state cursor."
:group 'meow)
(meow-define-state isearch
"Meow ISEARCH state minor mode."
:lighter " [S]"
:keymap meow-isearch-state-keymap
:cursor meow-isearch-cursor)
(defun meow-isearch-define-key (&rest keybinds)
(apply #'meow-define-keys 'isearch keybinds))
(defun meow-isearch-exit ()
"Switch to NORMAL state."
(interactive)
(cond
((meow-keypad-mode-p)
(meow--exit-keypad-state))
((and (meow-isearch-mode-p)
(eq meow--beacon-defining-kbd-macro 'quick))
(setq meow--beacon-defining-kbd-macro nil)
(meow-beacon-isearch-exit))
((meow-isearch-mode-p)
(when overwrite-mode
(overwrite-mode -1))
(isearch-done)
(meow--switch-state 'normal))))
(defun meow-isearch ()
"Move to the start of selection, switch to SEARCH state."
(interactive)
(if meow--temp-normal
(progn
(message "Quit temporary normal mode")
(meow--switch-state 'motion))
(meow--switch-state 'isearch)
(isearch-forward)))
(provide 'scamx-isearch)