local icon = require("fschauen.util.icons").ui.Graph 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, config = function() local group = vim.api.nvim_create_augroup("fschauen.plantuml", { clear = true }) vim.api.nvim_create_autocmd("FileType", { desc = "Create key map to toggle plantuml preview.", group = group, pattern = "plantuml", callback = function() vim.keymap.set( "n", "P", "PlantumlToggle", { buffer = true, desc = icon .. " toggle PlantUML [P]review" } ) end, }) end, }