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
|
import actions from '../actions';
const defaultKeymap = {
':': { type: actions.CMD_OPEN },
'o': { type: actions.CMD_TABS_OPEN, alter: false },
'O': { type: actions.CMD_TABS_OPEN, alter: true },
'b': { type: actions.CMD_BUFFER },
'k': { type: actions.SCROLL_LINES, count: -1 },
'j': { type: actions.SCROLL_LINES, count: 1 },
'<C-E>': { type: actions.SCROLL_LINES, count: -1 },
'<C-Y>': { type: actions.SCROLL_LINES, count: 1 },
'<C-U>': { type: actions.SCROLL_PAGES, count: -0.5 },
'<C-D>': { type: actions.SCROLL_PAGES, count: 0.5 },
'<C-B>': { type: actions.SCROLL_PAGES, count: -1 },
'<C-F>': { type: actions.SCROLL_PAGES, count: 1 },
'gg': { type: actions.SCROLL_TOP },
'G': { type: actions.SCROLL_BOTTOM },
'0': { type: actions.SCROLL_LEFT },
'$': { type: actions.SCROLL_RIGHT },
'd': { type: actions.TABS_CLOSE },
'u': { type: actions.TABS_REOPEN },
'h': { type: actions.TABS_PREV, count: 1 },
'l': { type: actions.TABS_NEXT, count: 1 },
'r': { type: actions.TABS_RELOAD, cache: false },
'R': { type: actions.TABS_RELOAD, cache: true },
'zi': { type: actions.ZOOM_IN },
'zo': { type: actions.ZOOM_OUT },
'zz': { type: actions.ZOOM_NEUTRAL },
'f': { type: actions.FOLLOW_START, newTab: false },
'F': { type: actions.FOLLOW_START, newTab: true },
'H': { type: actions.HISTORY_PREV },
'L': { type: actions.HISTORY_NEXT },
}
const asKeymapChars = (keys) => {
return keys.map((k) => {
let c = String.fromCharCode(k.code);
if (k.ctrl) {
return '<C-' + c.toUpperCase() + '>';
} else {
return c
}
}).join('');
}
const asCaretChars = (keys) => {
return keys.map((k) => {
let c = String.fromCharCode(k.code);
if (k.ctrl) {
return '^' + c.toUpperCase();
} else {
return c;
}
}).join('');
}
export { defaultKeymap, asKeymapChars, asCaretChars };
|