dotfiles/config/nvim/lua/fschauen/plugins/plantuml-previewer.lua
Fernando Schauenburg 3a273afd06 nvim: extract PlantUML JAR from launch script
I had previously hard-coded the path on my Debian install, but this
commit will find the correct JAR file as long as there is a `plantuml`
launch script in the PATH.
2024-07-12 13:26:26 +02:00

26 lines
626 B
Lua

return {
"weirongxu/plantuml-previewer.vim",
dependencies = {
"tyru/open-browser.vim",
},
cmd = {
"PlantumlOpen",
"PlantumlStart",
"PlantumlStop",
"PlantumlSave",
},
ft = "plantuml",
init = function()
-- Prefer the system PlantUML (if any) over the one bundled with the plugin.
local cmdline = [[which plantuml | xargs cat | grep plantuml.jar]]
local regex = [[\v\s['"]?(\S+/plantuml\.jar)]]
local jar = vim.fn.matchlist(vim.fn.system(cmdline), regex)[2]
if jar and vim.loop.fs_stat(jar) then
vim.g["plantuml_previewer#plantuml_jar_path"] = jar
end
end,
}