For autoformatting, try an autocmd:
autocmd BufWritePre * lua vim.lsp.buf.format()
Or alternatively, I use:
autocmd BufWritePre * lua require("utils").format()
-- Formats the current buffer
function utils.format()
local whitelist = { "python", "rust" }
if vim.tbl_contains(whitelist, vim.bo.filetype) then
vim.lsp.buf.format()
end
end
I tried this on Colemak and now my world is upside down.