]> git.mdlowis.com Git - projs/tide.git/commitdiff
added absolute minimum set of vi bindings for cursor movement
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 16 Oct 2016 04:00:15 +0000 (00:00 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 16 Oct 2016 04:00:15 +0000 (00:00 -0400)
Makefile
keyboard.c

index 71c0a42dbf265b1f6daad54ba56835fc379b97bf..54d6525dbaa94c901d2388fb66f8c0319ecea703 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,5 +18,6 @@ clean:
        $(RM) edit unittests xedit.o $(OBJS) $(TESTOBJS)
 
 $(OBJS): edit.h Makefile
+xedit.o: edit.h Makefile
 
 .PHONY: all test
index d6d2b096ad0ed728bde2b368440060f6242ac5c7..e63d543df41800b49e79d0ff1538a31274c02200 100644 (file)
@@ -88,5 +88,14 @@ static void control_keys(Rune key) {
 }
 
 static void vi_keys(Rune key) {
-    (void)key;
+    switch (key) {
+        case 'a': CursorPos++;
+        case 'i': Buffer.insert_mode = true; break;
+        case 'k': cursor_up();               break;
+        case 'j': cursor_dn();               break;
+        case 'h': cursor_left();             break;
+        case 'l': cursor_right();            break;
+        case '^': cursor_home();             break;
+        case '$': cursor_end();              break;
+    }
 }