vis

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

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

commit d621e0f5f5bc4743e36bc0d294d249e5f6a9d834
parent e918568c44b4ddbb164ff1db1194f148c2b96cbd
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 31 Dec 2015 13:01:04 +0100

Add section about Lua API to README

Diffstat:
MREADME.md | 39+++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -356,6 +356,45 @@ Operators can be forced to work line wise by specifying `V`. - internal spell checker - compile time configurable features / `#ifdef` mess +Lua API for in process extension +================================ + +Vis provides a simple Lua API for in process extension. At startup the +`visrc.lua` file is executed, this can be used to register a few event +callbacks which will be invoked from the editor core. While executing +these user scripts the editor core is blocked, hence it is intended for +simple short lived (configuration) tasks. + +At this time there exists no API stability guarantees. + + - `vis` + - `lexers` LPeg lexer support module + - `events` hooks + - `start()` + - `quit()` + - `win_open(win)` + - `win_close(win)` + - `files()` iterator + - `windows()` iterator + - `command(cmd)` + - `info(msg)` + - `open(filename)` + - `file` + - `insert(file, pos, data)` + - `delete(file, pos, len)` + - `lines_iterator(file)` + - `name` + - `lines[0..#lines+1]` array giving read/write access to lines + - `window` + - `file` + - `cursor` + - `line`, `col` + - `pos` bytes from start of file + +Most of the exposed objects are managed by the C core. Allthough there +is a simple object life time management mechanism in place, it is still +recommended to *not* let the Lua objects escape from the event handlers +(e.g. by assigning to global Lua variables). Text management using a piece table/chain =========================================