2024-02-26 12:42:51 -07:00
|
|
|
if vim.g.loaded_2html_plugin ~= nil then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
vim.g.loaded_2html_plugin = true
|
|
|
|
|
|
|
|
vim.api.nvim_create_user_command('TOhtml', function(args)
|
|
|
|
local outfile = args.args ~= '' and args.args or vim.fn.tempname() .. '.html'
|
2024-07-11 09:16:51 -07:00
|
|
|
local html = require('tohtml').tohtml(0, { range = { args.line1, args.line2 } })
|
2024-02-26 12:42:51 -07:00
|
|
|
vim.fn.writefile(html, outfile)
|
|
|
|
vim.cmd.split(outfile)
|
2024-02-28 10:01:38 -07:00
|
|
|
vim.bo.filetype = 'html'
|
2024-07-11 09:16:51 -07:00
|
|
|
end, { bar = true, nargs = '?', range = '%' })
|