-
Notifications
You must be signed in to change notification settings - Fork 1
/
bindings.dart
116 lines (109 loc) · 3.62 KB
/
bindings.dart
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
import 'action_typedefs.dart';
import 'actions_command.dart';
import 'actions_find.dart';
import 'actions_insert.dart';
import 'actions_motion.dart';
import 'actions_normal.dart';
import 'actions_operator.dart';
import 'keys.dart';
final normalActions = <String, NormalFn>{
'q': NormalActions.quit,
'Q': NormalActions.quitWithoutSaving,
'S': NormalActions.alias('^C'),
's': NormalActions.save,
'x': NormalActions.alias('dl'),
'i': NormalActions.insert,
'a': NormalActions.appendCharNext,
'A': NormalActions.alias('\$i'),
'I': NormalActions.alias('^i'),
'o': NormalActions.alias('A\n'),
'O': NormalActions.alias('^i\n${Keys.escape}ki'),
'r': NormalActions.replace,
'D': NormalActions.alias('d\$'),
'p': NormalActions.pasteAfter,
'P': NormalActions.pasteBefore,
Keys.ctrlD: NormalActions.moveDownHalfPage,
Keys.ctrlU: NormalActions.moveUpHalfPage,
'J': NormalActions.joinLines,
'C': NormalActions.alias('c\$'),
'u': NormalActions.undo,
'U': NormalActions.redo,
'.': NormalActions.repeat,
';': NormalActions.repeatFindStr,
'n': NormalActions.repeatFindStr,
Keys.ctrlA: NormalActions.increase,
Keys.ctrlX: NormalActions.decrease,
':': NormalActions.command,
'/': NormalActions.search,
Keys.ctrlW: NormalActions.toggleWrap,
'zz': NormalActions.centerView,
};
const normalOperatorActions = <String, OperatorFn>{
'c': Operators.change,
'd': Operators.delete,
'y': Operators.yank,
'gu': Operators.lowerCase,
'gU': Operators.upperCase,
};
const insertActions = <String, InsertFn>{
Keys.backspace: InsertActions.backspace,
Keys.newline: InsertActions.enter,
Keys.escape: InsertActions.escape,
};
const operatorActions = <String, OperatorFn>{
'c': Operators.change,
'd': Operators.delete,
'y': Operators.yank,
};
const motionActions = <String, MotionAction>{
'h': MotionAction(Motions.charPrev),
'l': MotionAction(Motions.charNext),
' ': MotionAction(Motions.charNext),
'k': MotionAction(Motions.lineUp, linewise: true),
'j': MotionAction(Motions.lineDown, linewise: true),
'w': MotionAction(Motions.wordNext),
'W': MotionAction(Motions.wordCapNext),
'b': MotionAction(Motions.wordPrev),
'B': MotionAction(Motions.wordCapPrev),
'e': MotionAction(Motions.wordEnd),
'ge': MotionAction(Motions.wordEndPrev),
'#': MotionAction(Motions.sameWordPrev),
'*': MotionAction(Motions.sameWordNext),
'0': MotionAction(Motions.lineStart),
'^': MotionAction(Motions.firstNonBlank),
'\$': MotionAction(Motions.lineEnd, inclusive: false),
'gg': MotionAction(Motions.fileStart, linewise: true),
'G': MotionAction(Motions.fileEnd, linewise: true),
'f': MotionAction(Find.findNextChar),
'F': MotionAction(Find.findPrevChar),
't': MotionAction(Find.tillNextChar),
'T': MotionAction(Find.tillPrevChar),
'{': MotionAction(Motions.paragraphPrev),
'}': MotionAction(Motions.paragraphNext),
'(': MotionAction(Motions.sentencePrev),
')': MotionAction(Motions.sentenceNext),
};
const commandActions = <String, CommandFn>{
'': CommandActions.noop,
'q': CommandActions.quit,
'quit': CommandActions.quit,
'q!': CommandActions.forceQuit,
'quit!': CommandActions.forceQuit,
'o': CommandActions.open,
'open': CommandActions.open,
'r': CommandActions.read,
'read': CommandActions.read,
'w': CommandActions.write,
'write': CommandActions.write,
'wq': CommandActions.writeAndQuit,
'x': CommandActions.writeAndQuit,
'exit': CommandActions.writeAndQuit,
'nowrap': CommandActions.setNoWrap,
'charwrap': CommandActions.setCharWrap,
'wordwrap': CommandActions.setWordWrap,
};
final normalBindings = <String, Object>{
...normalActions,
...motionActions,
...normalOperatorActions,
};