forked from hyaray/ahk_v2_vimd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVimDActionManager.ahk
More file actions
42 lines (36 loc) · 1 KB
/
Copy pathVimDActionManager.ahk
File metadata and controls
42 lines (36 loc) · 1 KB
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
#Requires AutoHotkey v2.0
class VimDActionManager {
/** @type {VimDMode} */
mode := ""
/** @type {Map<String, VimDAction>} */
actions := Map()
__new(mode) {
this.mode := mode
this.actions.CaseSense := true
}
HasAction(keySeq) {
if !(keySeq IS String)
keySeq := keySeq.ToString()
return this.actions.Has(keySeq)
}
GetAction(keySeq) {
if !(keySeq IS String)
keySeq := keySeq.ToString()
return this.actions[keySeq]
}
/**
* 返回以指定 keySeq 前缀开始的 action 列表
* @param {VimDKeySeqence|String} prefix
* @returns {Array} 返回 action 对象数组
*/
GetActionsStartingWith(prefix) {
if !(prefix IS String)
prefix := prefix.ToString()
arr := []
for k, v in this.actions {
if (SubStr(k, 1, StrLen(prefix)) == prefix)
arr.Push(v)
}
return arr
}
}