-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserenade-custom-commands.js
132 lines (106 loc) · 2.32 KB
/
serenade-custom-commands.js
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// This file includes various examples of how to navigate and control Vim with
// custom Serenade voice commands.
const vim = serenade.app('Vim');
vim.command(
'split',
(api) => api.evaluateInPlugin('vsplit'),
);
vim.command(
'horizontal split',
(api) => api.evaluateInPlugin('split'),
);
vim.command(
'back',
(api) => api.evaluateInPlugin('exec "normal \\<C-o>"'),
);
vim.command(
'forward',
// Not sure why "exec normal" doesn't work
(api) => api.evaluateInPlugin('call feedkeys("\\<Esc>\\<C-i>")'),
);
vim.command(
'window left',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>h"'),
);
vim.command(
'window down',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>j"'),
);
vim.command(
'window up',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>k"'),
);
vim.command(
'window right',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>l"'),
);
vim.command(
'swap window left',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>H"'),
);
vim.command(
'swap window down',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>J"'),
);
vim.command(
'swap window up',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>K"'),
);
vim.command(
'swap window right',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>L"'),
);
vim.command(
'window zoom',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>z"'),
);
vim.command(
'normalise windows',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>="'),
);
vim.command(
'switch',
(api) => api.evaluateInPlugin('exec "normal \\<C-w>\\<C-w>"'),
);
vim.command(
'top',
(api) => api.evaluateInPlugin('normal zt'),
);
vim.command(
'center',
(api) => api.evaluateInPlugin('normal zz'),
);
vim.command(
'bottom',
(api) => api.evaluateInPlugin('normal zb'),
);
vim.command(
'high',
(api) => api.evaluateInPlugin('normal H'),
);
vim.command(
'middle',
(api) => api.evaluateInPlugin('normal M'),
);
vim.command(
'low',
(api) => api.evaluateInPlugin('normal L'),
);
vim.command(
'turn on spelling',
(api) => api.evaluateInPlugin('set spell'),
);
vim.command(
'turn off spelling',
(api) => api.evaluateInPlugin('set nospell'),
);
vim.command(
'close',
(api) => api.evaluateInPlugin('q'),
{autoExecute: false},
);
vim.command(
'close file',
(api) => api.evaluateInPlugin('bdelete'),
{autoExecute: false},
);