dots/stow/.config/nvim/lua/nico/txt/enter.lua

21 lines
511 B
Lua

-- opts
vim.opt.wrap = true
vim.opt.linebreak = true
vim.opt.textwidth = 80
vim.opt.formatoptions:append("t")
-- ai slop that gets the job done
-- redo formatting when leaving the insert mode
vim.api.nvim_create_augroup("FormatText", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown", "txt" },
callback = function()
vim.api.nvim_create_autocmd("InsertLeave", {
buffer = 0,
callback = function()
vim.cmd("normal! gggqG")
end,
})
end,
})