vim-gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.
First of all, you should install gofmtmd.
go get github.com/po3rin/gofmtmd/cmd/gofmtmd
if you have not installed Go language. please install from release page. https://github.com/po3rin/gofmtmd/releases
you can use plugin.
" ex) if you use vim-plug (https://github.com/junegunn/vim-plug)
call plug#begin()
Plug 'po3rin/vim-gofmtmd' "add plugin here!!
let g:lsp_async_completion = 1
call plug#end()
command
:GoFmtMd
You can set following option to enable auto format when save file.
let g:gofmtmd_auto_fmt = 1