From 202fa363a4c0f94348b054f7cb574c747b731620 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Sun, 16 Oct 2016 00:00:15 -0400 Subject: [PATCH] added absolute minimum set of vi bindings for cursor movement --- Makefile | 1 + keyboard.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 71c0a42..54d6525 100644 --- 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 diff --git a/keyboard.c b/keyboard.c index d6d2b09..e63d543 100644 --- a/keyboard.c +++ b/keyboard.c @@ -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; + } } -- 2.49.0