My buffer is able to reload every time I pull changes from the remote, with:
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
I recently added auto-formatting for Bazel BUILD files, by adding this to my init.vim:
autocmd BufWritePost BUILD !buildifier <afile>
It works in that the file is formatted by buildifier, but my buffer is not automatically reloaded to reflect the changes.
Typing :e does refresh the buffer, but I can't seem to concatenate this :e to !buildifier <afile>. I tried:
autocmd BufWritePost BUILD !buildifier <afile> | :e
and
autocmd BufWritePost BUILD !buildifier <afile> | e
but both cases had :e or e recognized as an external command.
What's lacking here to make my buffer auto-reload?
autocmd BufWritePost BUILD \ !buildifier <afile>? Isn't that\just for line continuation? – Sibbs Gambling Mar 27 '22 at 18:02