summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/cfg/neoformat/init.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/cfg/neoformat/init.lua')
-rw-r--r--.config/nvim/lua/cfg/neoformat/init.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/.config/nvim/lua/cfg/neoformat/init.lua b/.config/nvim/lua/cfg/neoformat/init.lua
new file mode 100644
index 0000000..eb9596e
--- /dev/null
+++ b/.config/nvim/lua/cfg/neoformat/init.lua
@@ -0,0 +1,12 @@
+-- autoformat
+if O.format_on_save then
+ require("cfg.utils").define_augroups {
+ autoformat = {
+ {
+ "BufWritePre",
+ "*",
+ [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]],
+ },
+ },
+ }
+end