-- local autocmd = vim.api.nvim_create_autocmd -- Auto resize panes when resizing nvim window -- autocmd("VimResized", { -- pattern = "*", -- command = "tabdo wincmd =", -- }) vim.api.nvim_create_augroup('numbertoggle', { clear = true }) vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'WinEnter' }, { group = 'numbertoggle', pattern = '*', command = 'if &nu && mode() != "i" | set rnu | endif' }) vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'WinLeave' }, { group = 'numbertoggle', pattern = '*', command = 'if &nu | set nornu | endif' }) vim.api.nvim_create_autocmd({'BufWritePre'}, { pattern = "", command = 'lua vim.lsp.buf.format()' }) vim.api.nvim_create_autocmd({'BufWritePre'}, { pattern = "*.go", command = ":silent! lua require('go.format').gofmt()" })