From: Michael D. Lowis Date: Sun, 16 Oct 2016 04:00:15 +0000 (-0400) Subject: added absolute minimum set of vi bindings for cursor movement X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=202fa363a4c0f94348b054f7cb574c747b731620;p=projs%2Ftide.git added absolute minimum set of vi bindings for cursor movement --- 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; + } }