vis

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

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

commit 45ebbaa5903324f371669eedbd62a480e57ae43a
parent fd4bb503b0824c0ddea4317121541f7c991c2de5
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun, 27 Nov 2016 21:21:31 +0100

vis-lua: add file.path property denoting the absolute path to the file

Close #407

Diffstat:
MREADME.md | 3++-
Mvis-lua.c | 5+++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md @@ -621,7 +621,8 @@ At this time there exists no API stability guarantees. - `insert(pos, data)` - `delete(pos, len)` or `delete({start, finish})` - `lines_iterator()` - - `name` + - `name` file path relative to current working directory or `nil` if not yet associated + - `path` absolute path or `nil` if not yet associated - `lines[0..#lines+1]` array giving read/write access to lines - `newlines` type of newlines either `"lf"` or `"crlf"` - `size` current file size in bytes diff --git a/vis-lua.c b/vis-lua.c @@ -1096,6 +1096,11 @@ static int file_index(lua_State *L) { return 1; } + if (strcmp(key, "path") == 0) { + lua_pushstring(L, file->name); + return 1; + } + if (strcmp(key, "lines") == 0) { obj_ref_new(L, file->text, "vis.file.text"); return 1;