I am programming go and I want to run gofmt
with a shortcut and replace the content of the current source file with the output of gofmt
.
I have the following mapping defined in my vimrc:
map <C-r> :r ! gofmt %<CR>
but this does simply append the output to the current file. Is there a way to override it?