From 46b7b8db4544d916be58f7b992e2839fbe6ff946 Mon Sep 17 00:00:00 2001 From: Talha Qamar Date: Sun, 29 Sep 2024 23:27:26 +0500 Subject: [PATCH] added format on write --- ftplugin/hblang.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ftplugin/hblang.vim b/ftplugin/hblang.vim index 9cb4ab3..2e07215 100644 --- a/ftplugin/hblang.vim +++ b/ftplugin/hblang.vim @@ -1 +1,16 @@ setlocal commentstring=//\ %s + +function Hbformat() + silent! !hbc --fmt-stdout + if v:shell_error + echom "Errors in file" + !hbc --fmt-stdout + else + silent! %!hbc --fmt-stdout + endif +endfunction + +augroup hblang_group + autocmd! + autocmd BufWritePost *.hb :call Hbformat() +augroup END