nvim: properly handle formatting

This commit is contained in:
Price Hiller 2022-06-04 19:12:47 -05:00
parent 5056f3efec
commit 0a0f43438b

View File

@ -1,6 +1,23 @@
vim.api.nvim_create_autocmd('BufWrite', {
pattern = '*',
callback = function()
local filetype = vim.bo.filetype
local neoformat_types = { 'sh' }
local ignore_types = {}
for _, ig_type in ipairs(ignore_types) do
if filetype == ig_type then
return
end
end
for _, nf_type in ipairs(neoformat_types) do
if filetype == nf_type then
vim.cmd('Neoformat')
end
return
end
vim.cmd('lua vim.lsp.buf.format({ async = true })')
end,
})