Skip to content

Commit

Permalink
fix(windows): By not setting detached = true, we prevent Windows …
Browse files Browse the repository at this point in the history
…from creating a separate window for markmap, as windows don't have the concept of daemons. Instead of registering a service, we just let Neovim take take of the subprocess.
  • Loading branch information
Zeioth committed Feb 14, 2024
1 parent ded391d commit d7516ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua/markmap/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ M.setup = function(ctx)
reset_arguments()
table.insert(arguments, vim.fn.expand "%:p") -- current buffer path
if job ~= nil then uv.process_kill(job, 9) end
job = uv.spawn(run_markmap, { args = arguments, detached = true }, nil)
job = uv.spawn(run_markmap, { args = arguments }, nil)
end, { desc = "Show a mental map of the current file" })

cmd("MarkmapSave", function()
reset_arguments()
table.insert(arguments, "--no-open") -- specific to this command
table.insert(arguments, vim.fn.expand "%:p") -- current buffer path
if job ~= nil then uv.process_kill(job, 9) end -- kill -9 jobs
job = uv.spawn(run_markmap, { args = arguments, detached = true }, nil)
job = uv.spawn(run_markmap, { args = arguments }, nil)
end, { desc = "Save the HTML file without opening the mindmap" })

cmd("MarkmapWatch", function()
reset_arguments()
table.insert(arguments, "--watch") -- spetific to this command
table.insert(arguments, vim.fn.expand "%:p") -- current buffer path
if job ~= nil then uv.process_kill(job, 9) end
job = uv.spawn(run_markmap, { args = arguments, detached = true }, nil)
job = uv.spawn(run_markmap, { args = arguments }, nil)
end,
{ desc = "Show a mental map of the current file and watch for changes" }
)
Expand Down

0 comments on commit d7516ae

Please sign in to comment.