@@ -20,7 +20,7 @@ M.setup = function(ctx)
20
20
-- Set default options
21
21
if html_output == nil then
22
22
if is_windows then
23
- html_output = uv . os_getenv " TEMP" .. " \\ " .. " markmap.html"
23
+ html_output = " TEMP" .. " \\ " .. " markmap.html"
24
24
elseif is_android then
25
25
html_output = " /data/data/com.termux/files/usr/tmp/markmap.html"
26
26
else -- unix
@@ -62,17 +62,17 @@ M.setup = function(ctx)
62
62
-- Setup commands -----------------------------------------------------------
63
63
cmd (" MarkmapOpen" , function ()
64
64
reset_arguments ()
65
- table.insert (arguments , vim .fn .expand " %:p" ) -- current buffer path
65
+ table.insert (arguments , vim .fn .expand " %:p" ) -- current buffer path
66
66
if job ~= nil then jobstop (job ) end
67
- job = jobstart ( run_markmap , { args = arguments })
67
+ job = jobstart { run_markmap , unpack ( arguments ) }
68
68
end , { desc = " Show a mental map of the current file" })
69
69
70
70
cmd (" MarkmapSave" , function ()
71
71
reset_arguments ()
72
- table.insert (arguments , " --no-open" ) -- specific to this command
73
- table.insert (arguments , vim .fn .expand " %:p" ) -- current buffer path
74
- if job ~= nil then jobstop (job ) end -- kill jobs
75
- job = jobstart ( run_markmap , { args = arguments })
72
+ table.insert (arguments , " --no-open" ) -- specific to this command
73
+ table.insert (arguments , vim .fn .expand " %:p" ) -- current buffer path
74
+ if job ~= nil then jobstop (job ) end -- kill jobs
75
+ job = jobstart { run_markmap , unpack ( arguments ) }
76
76
end , { desc = " Save the HTML file without opening the mindmap" })
77
77
78
78
cmd (
@@ -81,14 +81,14 @@ M.setup = function(ctx)
81
81
reset_arguments ()
82
82
table.insert (arguments , " --watch" ) -- spetific to this command
83
83
table.insert (arguments , vim .fn .expand " %:p" ) -- current buffer path
84
- if job ~= nil then jobstop (job ) end -- kill jobs
85
- job = jobstart ( run_markmap , { args = arguments })
84
+ if job ~= nil then jobstop (job ) end -- kill jobs
85
+ job = jobstart { run_markmap , unpack ( arguments ) }
86
86
end ,
87
87
{ desc = " Show a mental map of the current file and watch for changes" }
88
88
)
89
89
90
90
cmd (" MarkmapWatchStop" , function ()
91
- if job ~= nil then jobstop (job ) end -- kill jobs
91
+ if job ~= nil then jobstop (job ) end -- kill jobs
92
92
end , { desc = " Manually stops markmap watch" })
93
93
94
94
-- Autocmds -----------------------------------------------------------------
@@ -107,7 +107,7 @@ M.setup = function(ctx)
107
107
-- Otherwise, use grace_period
108
108
local current_time = uv .now ()
109
109
if current_time - last_execution >= grace_period then -- if grace period exceeded
110
- if job ~= nil then jobstop (job ) end -- pkill jobs
110
+ if job ~= nil then jobstop (job ) end -- pkill jobs
111
111
last_execution = current_time -- update time
112
112
end
113
113
end ,
@@ -118,7 +118,7 @@ M.setup = function(ctx)
118
118
desc = " Kill all markmap jobs before closing nvim" ,
119
119
group = augroup (" markmap_kill_pre_exit_nvim" , { clear = true }),
120
120
callback = function ()
121
- if job ~= nil then jobstop (job ) end -- kill jobs
121
+ if job ~= nil then jobstop (job ) end -- kill jobs
122
122
end ,
123
123
})
124
124
end
0 commit comments