You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

52 lines
1.3 KiB

local aucmd_dict = {
FileType = {
{
pattern = "dart,vue,js",
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
vim.opt_local.shiftwidth = 2
end,
},
},
BufWritePre = {
{
command = [[%s/\s\+$//e]],
},
{
pattern = 'go',
callback = function () require('go.format').gofmt() end,
},
},
BufRead = {
{
command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]]
},
{
pattern = { '*.docker' },
callback = function()
vim.opt_local.syntax = 'dockerfile'
end
}
},
BufNewFile = {
{
pattern = { '*.docker' },
callback = function()
vim.opt_local.syntax = 'dockerfile'
end
}
},
VimLeave = {
{
command = [[mksession! ~/.config/nvim/session/shutdown_session.vim]]
},
},
}
for event, opt_tbls in pairs(aucmd_dict) do
for _, opt_tbl in pairs(opt_tbls) do
vim.api.nvim_create_autocmd(event, opt_tbl)
end
end