consider the bit of vimscript like:
func! ClangFormatFile()
silent exec ":! mv % %.old && clang-format %.old >> %"
endfunc
which means I'd like to format the current file with clang-format
but keep the old version.
On top of that I'd like to disable the "File has changed, do you want to reload?" prompt, but just reload the file.
Using set autoread
, then execute the mv
and clang-format
, then set noautoread
within the function has unfortunately no effect.
e! %
to line 3? Does that solve it for you?