aboutsummaryrefslogtreecommitdiff
path: root/runtime/plugin/tohtml.lua
diff options
context:
space:
mode:
authoraltermo <107814000+altermo@users.noreply.github.com>2024-02-26 11:42:51 -0800
committerLewis Russell <me@lewisr.dev>2024-02-28 16:26:00 +0000
commit2f85bbe61513d12c746641fed6ad07559bd95719 (patch)
tree52bf628d6ea746e7508d576b441122beffe8a3b7 /runtime/plugin/tohtml.lua
parentc538ec85220aea11bbdb52028aa335787e9e4f42 (diff)
downloadrneovim-2f85bbe61513d12c746641fed6ad07559bd95719.tar.gz
rneovim-2f85bbe61513d12c746641fed6ad07559bd95719.tar.bz2
rneovim-2f85bbe61513d12c746641fed6ad07559bd95719.zip
feat!: rewrite TOhtml in lua
Co-authored-by: wookayin <wookayin@gmail.com> Co-authored-by: clason <c.clason@uni-graz.at> Co-authored-by: Lewis Russell <me@lewisr.dev>
Diffstat (limited to 'runtime/plugin/tohtml.lua')
-rw-r--r--runtime/plugin/tohtml.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/plugin/tohtml.lua b/runtime/plugin/tohtml.lua
new file mode 100644
index 0000000000..893419ece6
--- /dev/null
+++ b/runtime/plugin/tohtml.lua
@@ -0,0 +1,11 @@
+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()
+ vim.fn.writefile(html, outfile)
+ vim.cmd.split(outfile)
+end, { bar = true, nargs = '?' })