Dot_Files/.config/nvim/lua/plugins/autocmds.lua

24 lines
594 B
Lua
Raw Normal View History

2022-06-12 23:38:14 -05:00
vim.api.nvim_create_autocmd('BufWritePre', {
2022-06-04 18:23:58 -05:00
pattern = '*',
2022-06-02 20:29:48 -05:00
callback = function()
2022-06-04 19:12:47 -05:00
local filetype = vim.bo.filetype
local neoformat_types = { 'sh' }
local ignore_types = { 'sql' }
2022-06-04 19:12:47 -05:00
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')
return
2022-06-04 19:12:47 -05:00
end
end
2022-06-12 23:38:14 -05:00
vim.cmd('lua vim.lsp.buf.format({})')
2022-06-02 20:29:48 -05:00
end,
2022-05-19 16:48:31 -05:00
})