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 local _, _, path, line = string.find(ref, "^(.+):(%d+)$") if path == nil or line == nil or line == 0 or not file_exists(path) then return end win:close() vis:command("e "..path) vis:command("+"..line-1) end)