aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlend Lind Madsen <erlendf80@gmail.com>2022-01-23 23:04:04 +0100
committerErlend Lind Madsen <erlendf80@gmail.com>2022-01-23 23:04:50 +0100
commitf022a93bbbb796ac44739dfdf2dd819d70189411 (patch)
tree49209339b924ecf2b1094b07d461cb3168ee3eb6
parent2bb11524d3863be7d6ea796cf2ba0142e59be9d7 (diff)
downloadvis-cursors-f022a93bbbb796ac44739dfdf2dd819d70189411.tar.gz
add a few comments
-rw-r--r--init.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index c33abb4..f91dde9 100644
--- a/init.lua
+++ b/init.lua
@@ -1,7 +1,6 @@
local M = {}
local cursors = {}
local files = {}
-M.maxsize = 1000
-- get the default system cache directory
local get_default_cache_path = function()
@@ -11,8 +10,12 @@ local get_default_cache_path = function()
return BASE .. '/.vis-cursors'
end
+-- default save path
M.path = get_default_cache_path()
+-- default maxsize
+M.maxsize = 1000
+
-- read cursors from file on init
local on_init = function()
@@ -51,15 +54,17 @@ local on_win_open = function(win)
-- insert current path to top of files
table.insert(files, 1, win.file.path)
- --
+ -- init cursor path if nil
local pos = cursors[win.file.path]
if pos == nil then
cursors[win.file.path] = win.selection.pos
return
end
+ -- set current cursor
win.selection.pos = tonumber(pos)
+ -- center view around cursor
vis:feedkeys("zz")
end