From 78c48b2a3098485b7fd471fc855432ed9e7ede58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 2 Sep 2014 08:50:06 +0200 Subject: First try at a repeat command i.e. '.' --- config.def.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index c6ef3f5..b43c03b 100644 --- a/config.def.h +++ b/config.def.h @@ -168,9 +168,13 @@ static void mark_goto(const Arg *arg) { vis_mark_goto(vis, arg->i); } -static Action action; +static Action action, action_prev; void action_do(Action *a); +static void repeat(const Arg *arg) { + action_do(&action_prev); +} + static void count(const Arg *arg) { action.count = action.count * 10 + arg->i; } @@ -240,7 +244,11 @@ void action_do(Action *a) { c.count = a->count; if (a->op) a->op(&c); - action_reset(a); + if (a != &action_prev) { + if (a->op) + action_prev = *a; + action_reset(a); + } } /* use vim's @@ -375,6 +383,7 @@ static KeyBinding vis_normal[] = { { { CONTROL('w'), NONE('k') }, call, { .f = vis_window_prev } }, { { CONTROL('F') }, cursor, { .m = window_page_up } }, { { CONTROL('B') }, cursor, { .m = window_page_down } }, + { { NONE('.') }, repeat, { } }, { { NONE('n') }, find_forward, { .s = "if" } }, { { NONE('p') }, find_backward, { .s = "if" } }, { { NONE('x') }, cursor, { .f = vis_delete_key } }, -- cgit v1.2.3