aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-12-31 13:01:04 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-12-31 13:20:12 +0100
commit4a7906a7ef20265dabc9f2a5e282862155bb6eed (patch)
tree5cbd97f6c6ea16dffd61734fe04679ba5bf26fc1
parent92fef29765f2a2f3098bbd48ce534e50dcfe4d99 (diff)
downloadvis-4a7906a7ef20265dabc9f2a5e282862155bb6eed.tar.gz
vis-4a7906a7ef20265dabc9f2a5e282862155bb6eed.tar.xz
Add section about Lua API to README
-rw-r--r--README.md39
1 files changed, 39 insertions, 0 deletions
diff --git a/README.md b/README.md
index f8a5fa1..63ca1ec 100644
--- 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
=========================================