From bdecfbd72db0742d38938d82c2ba8faa05f3f01d Mon Sep 17 00:00:00 2001 From: Nicolas Camenisch Date: Sat, 14 May 2022 23:25:36 -0400 Subject: [PATCH] Add autocmd so that GuessIndent runs when new files are saved --- lua/guess-indent/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/guess-indent/init.lua b/lua/guess-indent/init.lua index 53943c9..6f9c4fd 100644 --- a/lua/guess-indent/init.lua +++ b/lua/guess-indent/init.lua @@ -13,7 +13,9 @@ local function setup_autocommands() vim.cmd([[ augroup GuessIndent autocmd! - autocmd BufReadPost * :silent lua require("guess-indent").set_from_buffer(true) + autocmd BufReadPost * silent lua require("guess-indent").set_from_buffer(true) + " Run once when saving for new files + autocmd BufNewFile * autocmd BufWritePost ++once silent lua require("guess-indent").set_from_buffer(true) augroup END ]]) end