File: tohtml.lua

package info (click to toggle)
neovim 0.11.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,140 kB
  • sloc: ansic: 263,427; python: 1,472; lisp: 1,237; sh: 1,138; makefile: 383; xml: 84; ruby: 6
file content (12 lines) | stat: -rw-r--r-- 442 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
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'
  local html = require('tohtml').tohtml(0, { range = { args.line1, args.line2 } })
  vim.fn.writefile(html, outfile)
  vim.cmd.split(outfile)
  vim.bo.filetype = 'html'
end, { bar = true, nargs = '?', range = '%' })