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