diff options
| author | Matěj Cepl <mcepl@cepl.eu> | 2024-09-25 00:36:54 +0200 |
|---|---|---|
| committer | Matěj Cepl <mcepl@cepl.eu> | 2024-09-25 00:36:54 +0200 |
| commit | 7e1eceeb9c8cc191ea6d84f47ee3064e1dad8610 (patch) | |
| tree | c3d871686acd4144bc4905b3fef8c9a8ed7a650f | |
| parent | bbf5f8cda0bb09babac06888ab9bac5fa2117048 (diff) | |
| download | vis-open-extend-7e1eceeb9c8cc191ea6d84f47ee3064e1dad8610.tar.gz vis-open-extend-7e1eceeb9c8cc191ea6d84f47ee3064e1dad8610.zip | |
fix: skip if the file with the colon in the name actually exists
This is an attempt to avoid need to add special arguments to vis
like -a or so.
| -rw-r--r-- | init.lua | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -10,6 +10,12 @@ 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 + + -- if the file with colon actually exists, don't do anything + if file_exists(ref) then + return + end + local _, _, path, line = string.find(ref, "^(.+):(%d+)$") if path == nil or line == nil or line == 0 or not file_exists(path) then return @@ -19,5 +25,4 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) vis:command("e "..path) vis:command("+"..line-1) -- or vis:feedkeys(tostring(line).."G") - return end) |
