mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
0246f1a897
Problem: `:TOhtml` opens the generated HTML code in a split, meaning it inherits the `help` filetype if a help buffer is to be converted. Solution: Explicitly set the filetype to `html`.
13 lines
388 B
Lua
13 lines
388 B
Lua
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)
|
|
vim.bo.filetype = 'html'
|
|
end, { bar = true, nargs = '?' })
|