aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-21 10:00:11 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-21 10:01:40 +0200
commit130e629434c4d87a18a886e5f98fa83dd897f742 (patch)
tree3e5bbe6b4be63fd3af4613a06bf5cf580bf664aa /README.md
parent07d8486f657dded76c6317550377962899f9152f (diff)
downloadvis-130e629434c4d87a18a886e5f98fa83dd897f742.tar.gz
vis-130e629434c4d87a18a886e5f98fa83dd897f742.tar.xz
vis-lua: add vis:command_register to map a Lua function to a :-command
The following registers `:foo` as a command which prints a few things to stdout: vis:command_register("foo", function(argv, force, win, cursor, range) for i,arg in ipairs(argv) do print(i..": "..arg) end print("was command forced with ! "..(force and "yes" or "no")) print(win.file.name) print(cursor.pos) print(range ~= nil and ('['..range.start..', '..range.finish..']') or "invalid range") return true; end)
Diffstat (limited to 'README.md')
-rw-r--r--README.md1
1 files changed, 1 insertions, 0 deletions
diff --git a/README.md b/README.md
index 96bbec5..1abd8b2 100644
--- a/README.md
+++ b/README.md
@@ -594,6 +594,7 @@ At this time there exists no API stability guarantees.
- `textobject(id)` select/execute a text object
- `motion_register(function)` register a Lua function as a motion, returns associated `id` or `-1`
- `motion(id)` select/execute a motion
+ - `command_register(name, function(argv, force, win, cursor, range))` hook up a Lua function to `:name` command
- `map(mode, key, function)` map a Lua function to `key` in `mode`
- `file`
- `content(pos, len)`