diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-02 08:50:06 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-02 08:50:06 +0200 |
| commit | 78c48b2a3098485b7fd471fc855432ed9e7ede58 (patch) | |
| tree | 74d7f2d1d4e331c454d5813287089d294a5327d5 /config.def.h | |
| parent | 22f9ac9d286e22a5146049e9bf8c862f224f8ab9 (diff) | |
| download | vis-78c48b2a3098485b7fd471fc855432ed9e7ede58.tar.gz vis-78c48b2a3098485b7fd471fc855432ed9e7ede58.tar.xz | |
First try at a repeat command i.e. '.'
Diffstat (limited to 'config.def.h')
| -rw-r--r-- | config.def.h | 13 |
1 files 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 } }, |
