tohtml.lua 442 B

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