diff options
| author | Matěj Cepl <mcepl@cepl.eu> | 2024-09-18 17:27:42 +0200 |
|---|---|---|
| committer | Matěj Cepl <mcepl@cepl.eu> | 2024-09-18 17:27:42 +0200 |
| commit | 25d0064a87c319ab69233d7669e4a5d0370a7afa (patch) | |
| tree | 91a8089b745df0aa7da06d22fec374d3f97b5c6f | |
| parent | c349451d309c96c773c5fb3e04369aef940a8a96 (diff) | |
| download | vis-open-extend-25d0064a87c319ab69233d7669e4a5d0370a7afa.tar.gz vis-open-extend-25d0064a87c319ab69233d7669e4a5d0370a7afa.zip | |
fix: add missing file_exists function
And try to set corrected win.file.path
| -rw-r--r-- | init.lua | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1,3 +1,12 @@ +local function file_exists(path) + local f = io.open(path) + local out = f ~= nil + if out then + io.close(f) + end + return out +end + vis.events.subscribe(vis.events.WIN_OPEN, function(win) if win.file == nil or win.file.path == nil then return end local ref = win.file.path @@ -6,6 +15,8 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) return end win:close() + win.file.path = path vis:command("e "..path) vis:command("+"..line-1) + vis:info("win.file.path = " .. path) end) |
