summaryrefslogtreecommitdiff
path: root/src/key_state.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/key_state.zig')
-rw-r--r--src/key_state.zig17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/key_state.zig b/src/key_state.zig
index b5b16ee..19177cf 100644
--- a/src/key_state.zig
+++ b/src/key_state.zig
@@ -18,8 +18,19 @@ pub const Error = error{
18 std.os.SchedYieldError; 18 std.os.SchedYieldError;
19pub const KeyState = fn(*Editor, *Buffer, Key) Error!void; 19pub const KeyState = fn(*Editor, *Buffer, Key) Error!void;
20 20
21pub fn mgState(editor: *Editor, buf: *Buffer, key: Key) Error!void {
22 editor.current_state = defaultState;
23 editor.clearStatusMessage();
24
25 switch (key) {
26 // ========== <*> ==========
27 Key.char('g') => try buf.goToLine(editor),
28
29 else => try editor.setStatusMessage("Unknown chord: M-g {}", .{key}),
30 }
31}
32
21pub fn cxState(editor: *Editor, buf: *Buffer, key: Key) Error!void { 33pub fn cxState(editor: *Editor, buf: *Buffer, key: Key) Error!void {
22 _ = buf;
23 editor.current_state = defaultState; 34 editor.current_state = defaultState;
24 editor.clearStatusMessage(); 35 editor.clearStatusMessage();
25 36
@@ -44,6 +55,10 @@ pub fn defaultState(editor: *Editor, buf: *Buffer, key: Key) Error!void {
44 Key.metaCtrl('d'), Key.backspace => try buf.backwardDeleteChar(), 55 Key.metaCtrl('d'), Key.backspace => try buf.backwardDeleteChar(),
45 56
46 // ========== M-<*> ========== 57 // ========== M-<*> ==========
58 Key.meta('g') => {
59 editor.current_state = mgState;
60 try editor.setStatusMessage("M-g-", .{});
61 },
47 Key.meta('v'), Key.page_up => buf.pageUp(editor.screenrows), 62 Key.meta('v'), Key.page_up => buf.pageUp(editor.screenrows),
48 63
49 // ========== C-<*> ========== 64 // ========== C-<*> ==========