-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfinder-vim-spotlight-addon.yaml
116 lines (115 loc) · 3.79 KB
/
finder-vim-spotlight-addon.yaml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# yaml-language-server: $schema=../schema/karabiner-mod-schema.json
title: "Finder Vim Controls – Spotlight Addon"
homepage: https://github.com/chrisgrieser/finder-vim-mode
maintainers: [pseudometa (chrisgrieser)]
anchors:
- conditions:
- &finder-app
type: frontmost_application_if
bundle_identifiers: [^com\.apple\.finder$]
- &is-spotlight-mode
type: variable_if
name: FINDER_SPOTLIGHT_MODE
value: true
- ¬-spotlight-mode
type: variable_unless
name: FINDER_SPOTLIGHT_MODE
value: true
- to:
- &enter-insert-mode
set_variable:
name: FINDER_INSERT_MODE
value: true
- &leave-insert-mode
set_variable:
name: FINDER_INSERT_MODE
value: false
- &remove-insert-notice
set_notification_message:
id: insert-notice
text: ""
- &leave-find-mode
set_variable:
name: FINDER_FIND_MODE
value: false
- &remove-find-notice
set_notification_message:
id: find-notice
text: ""
- &end-menu
set_variable:
name: FINDER_MENU_ACTIVE
value: false
- &remove-menu-notice
set_notification_message:
id: menu-notice
text: ""
- &enter-spotlight-mode
set_variable:
name: FINDER_SPOTLIGHT_MODE
value: true
- &leave-spotlight-mode
set_variable:
name: FINDER_SPOTLIGHT_MODE
value: false
- &remove-spotlight-notice
set_notification_message:
id: spotlight-notice
text: ""
- &spotlight-notice
set_notification_message:
id: spotlight-notice
text: "🔦 Spotlight Mode"
#─────────────────────────────────────────────────────────────────────────
# Opening Alfred/Raycast/Spotlight cancels renaming and context menu,
# so the respective modes have to be aborter here as well
rules:
- description: "Finder Vim Controls – Spotlight Addon"
manipulators:
- type: basic
from: { key_code: spacebar, modifiers: { mandatory: [command] } }
to:
- { key_code: spacebar, modifiers: [command] }
- *remove-insert-notice
- *leave-insert-mode
- *remove-menu-notice
- *end-menu
- *spotlight-notice
- *leave-find-mode
- *remove-find-notice
- *enter-spotlight-mode # enter spotlight
- *enter-insert-mode
conditions: [*finder-app, *not-spotlight-mode]
# leave spotlight mode
- type: basic
from: { key_code: spacebar, modifiers: { mandatory: [command] } }
to:
- { key_code: spacebar, modifiers: [command] }
- *remove-spotlight-notice
- *leave-spotlight-mode
- *leave-insert-mode
conditions: [*is-spotlight-mode]
- type: basic
from: { key_code: escape }
to:
- { key_code: escape }
- *remove-spotlight-notice
- *leave-spotlight-mode
- *leave-insert-mode
conditions: [*is-spotlight-mode]
- type: basic
from: { key_code: caps_lock }
to:
- { key_code: escape }
- *remove-spotlight-notice
- *leave-spotlight-mode
- *leave-insert-mode
conditions: [*is-spotlight-mode]
- type: basic
from: { key_code: return_or_enter, modifiers: { optional: [command] } }
to:
- { key_code: return_or_enter }
- *remove-spotlight-notice
- *leave-spotlight-mode
- *leave-insert-mode
conditions: [*is-spotlight-mode]