vis

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

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

commit 88cf55ac7123d065034a22b7f9317716e832867a
parent 4f55b9ccb722bed3602010104035bbeb72d5bdc9
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat, 16 Apr 2016 12:40:58 +0200

vis-lua: add vis.mode property

Diffstat:
MREADME.md | 1+
Mvis-lua.c | 5+++++
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -570,6 +570,7 @@ At this time there exists no API stability guarantees. - `vis` - `MODE_NORMAL`, `MODE_OPERATOR_PENDING`, `MODE_INSERT`, `MODE_REPLACE`, `MODE_VISUAL`, `MODE_VISUAL_LINE` mode constants + - `mode` current mode (one of the above constants) - `lexers` LPeg lexer support module - `events` hooks - `start()` diff --git a/vis-lua.c b/vis-lua.c @@ -444,6 +444,11 @@ static int vis_index(lua_State *L) { return 1; } + if (strcmp(key, "mode") == 0) { + lua_pushunsigned(L, vis->mode->id); + return 1; + } + if (strcmp(key, "MODE_NORMAL") == 0) { lua_pushunsigned(L, VIS_MODE_NORMAL); return 1;