init.lua 344 B

12345678910111213141516
  1. -- autoformat
  2. if O.format_on_save then
  3. require("lv-utils").define_augroups {
  4. autoformat = {
  5. {
  6. "BufWritePre",
  7. "*",
  8. [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]],
  9. },
  10. },
  11. }
  12. end
  13. if not O.format_on_save then
  14. vim.cmd ":autocmd! autoformat"
  15. end