summaryrefslogtreecommitdiffstats
path: root/lua/inbox/renderers/nvim.lua
blob: 223ab4e16786d0135dac06956c72de56fbda3419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---@type inbox.Renderer
local M = {}

function M.render(bufnr)
	local entry = vim.b[bufnr].inbox.entry
	local content_type = vim.b[bufnr].inbox.content_type
	local part = entry.parts[content_type]

	local lines = vim.split(part.content, "\n")

	vim.bo[bufnr].filetype = "mail"
	vim.bo[bufnr].syntax = "mail"
	vim.bo[bufnr].modifiable = true
	vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, lines)
	vim.bo[bufnr].modifiable = false
	vim.bo[bufnr].modified = false
end

return M