1. procedure(dbkSwitchBindKey()
2. /*--DOC--
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.
(gv~>bindKey=="custom" || t
defaultBindKey1="./defaultBindKey.il"
3. API:
defaultBindKey2="~/defaultBindKey.il"
4. dbkSwitchBindKey()
cond(
实例 19
5. => t / nil
(isFile(defaultBindKey1)
6. Description: Swtich between defaultBindKey and myBindKey
7. Arguments:
load(defaultBindKey1)
hiSetBindKey( "Layout" "<Key>Tab" "dbkSwitchBindKey()")
8. Value Returned:
hiSetBindKey( "Schematics" "<Key>Tab" "dbkSwitchBindKey()")
9.
t
Swtich between defaultBindKey and myBindKey successfully.
defaultBindKey.il locats at . or ~
gv~>bindKey="default"
10.
11.
12.
info("set bindKey to default")
myBindKey.il locats at . or ~
)
if found, will load it
(isFile(defaultBindKey2)
13. nil can't find defaultBindKey.il or myBindKey.il or can't find variable gv
14. Examples:
load(defaultBindKey2)
hiSetBindKey( "Layout" "<Key>Tab" "dbkSwitchBindKey()")
15. dbkSwitchBindKey()
hiSetBindKey( "Schematics" "<Key>Tab" "dbkSwitchBindKey()")
16. */;--ENDDOC--
gv~>bindKey="default"
17. prog((myBindKey1 myBindKey2 defaultBindKey1 defaultBindKey2)
info("set bindKey to default")
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.
unless(boundp('gv)
)
warn("can't find variable gv")
(t
return(nil))
warn("can't access defaultBindKey.il")
unless(gv~>bindKey gv~>bindKey="default")
return(nil)
cond(
)
(gv~>bindKey=="default"
myBindKey1="./myBindKey.il"
myBindKey2="~/myBindKey.il"
cond(
); custom
)
;(t
;
gv~>bindKey="default"
(isFile(myBindKey1)
load(myBindKey1)
gv~>bindKey="custom"
info("set bindKey to custom")
)
;)
);cond
t
))
hiSetBindKey( "Layout" "<Key>Tab" "dbkSwitchBindKey()")
hiSetBindKey( "Schematics" "<Key>Tab" "dbkSwitchBindKey()")
(isFile(myBindKey2)
load(myBindKey2)
gv~>bindKey="custom"
info("set bindKey to custom")
)
通过Tab键切换两套Bindkey设置
• gv 是一个defstruct, 在数据结构里有介绍,需要事先创建
• 通过记录状态 gv~>bindKey 来循环切换
(t
warn("can't access myBindKey.il")
return(nil)
• 这是一个较规范的脚本实例,通过注释说明函数的使用方法
)
)
2022/02/06
);default
Skill 教程
112