vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 882e4047b8fe68fd82261fea4e2019e795c172aa
parent 8f9ae2309338b295a4bc6a427412e1d765e46cf1
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 22 Feb 2017 23:25:34 +0100

vis-lua: expose current count specifier as vis:count

Diffstat:
Mvis-lua.c | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/vis-lua.c b/vis-lua.c @@ -563,6 +563,10 @@ static const char *keymapping(Vis *vis, const char *keys, const Arg *arg) { * LPeg lexer module. * @field lpeg might be `nil` if module is not found */ +/*** + * Current count. + * @tfield int count the specified count for the current command or `nil` if none was given + */ /*** * Create an iterator over all windows. @@ -1111,6 +1115,15 @@ static int vis_index(lua_State *L) { return 1; } + if (strcmp(key, "count") == 0) { + int count = vis_count_get(vis); + if (count == VIS_COUNT_UNKNOWN) + lua_pushnil(L); + else + lua_pushunsigned(L, count); + return 1; + } + if (strcmp(key, "registers") == 0) { obj_ref_new(L, vis->ui, "vis.registers"); return 1;