From 0c6771a385e3f2e4a9f1e5ae80eb7615e4fa99e0 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 6 Jul 2021 22:55:11 -0400 Subject: you can now toggle format on and off on the fly! --- lua/lv-neoformat/init.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lua/lv-neoformat/init.lua (limited to 'lua/lv-neoformat') diff --git a/lua/lv-neoformat/init.lua b/lua/lv-neoformat/init.lua new file mode 100644 index 00000000..a1540370 --- /dev/null +++ b/lua/lv-neoformat/init.lua @@ -0,0 +1,16 @@ +-- autoformat +if O.format_on_save then + require("lv-utils").define_augroups { + autoformat = { + { + "BufWritePre", + "*", + [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]], + }, + }, + } +end + +if not O.format_on_save then + vim.cmd ":autocmd! autoformat" +end -- cgit v1.2.3