aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 3f830cd..6268d59 100644
--- a/init.lua
+++ b/init.lua
@@ -16,8 +16,8 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
return
end
- local _, _, path, line = string.find(ref, "^(.+):(%d+)$")
- if path == nil or line == nil or line == 1 or not file_exists(path) then
+ local path, line, column = ref:match("^(.-):(%d+):?(%d*):?$")
+ if not path or not line or tonumber(line) == 1 or not file_exists(path) then
return
end
@@ -28,8 +28,14 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
-- After the other handlers ran we set the position.
vis:feedkeys(line.."G")
+ if column then
+ vis:feedkeys(tostring(column) .. "l")
+ end
+
-- Stop handling the old FILE_OPEN event since we changed the file and emitted
-- a new WIN_OPEN event
+
+ -- Prevent further WIN_OPEN event handlers from running
return true
end)