tohtml.lua (461B)
1 if vim.g.loaded_2html_plugin ~= nil then 2 return 3 end 4 vim.g.loaded_2html_plugin = true 5 6 vim.api.nvim_create_user_command('TOhtml', function(args) 7 local outfile = args.args ~= '' and args.args or vim.fn.tempname() .. '.html' 8 local html = require('tohtml').tohtml(0, { range = { args.line1, args.line2 } }) 9 vim.fn.writefile(html, outfile) 10 vim.cmd.split(outfile) 11 vim.bo.filetype = 'html' 12 end, { bar = true, nargs = '?', range = '%', complete = 'file' })