blob: a892fa258d21ef6eaa10feb18b80fc55cdd8450d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
local autocmd_group = vim.api.nvim_create_augroup("Custom auto-commands", { clear = true })
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = { "*.py" },
desc = "Auto-format python files after saving",
callback = function()
local filename = vim.api.nvim_buf_get_name(0)
vim.cmd(":silent !autopep8 -i " .. filename)
vim.cmd(":silent !isort " .. filename)
end,
group = autocmd_group,
})
vim.api.nvim_create_autocmd({ "CursorHold" }, {
desc = "reload the file on changes",
command = "checktime",
group = autocmd_group,
})
|