From 836f0068dc03627bc48afa32db5256947beb8195 Mon Sep 17 00:00:00 2001 From: grepsuzette <350354+grepsuzette@users.noreply.github.com> Date: Fri, 5 May 2023 00:53:40 +0800 Subject: [PATCH] chore: add explanations about how to use gofumpt in vim (#747) Co-authored-by: grepsuzette --- CONTRIBUTING.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e5f1c22411b..2a567c8539f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,7 +79,7 @@ Add to your `.vimrc` file: ```vim function! GnoFmt() - cexpr system('gofmt -e -w ' . expand('%')) "or replace with gofumpt + cexpr system('gofmt -e -w ' . expand('%')) "or replace with gofumpt, see below edit! endfunction command! GnoFmt call GnoFmt() @@ -90,6 +90,12 @@ augroup gno_autocmd augroup END ``` +To use *gofumpt* instead of *gofmt*, as hinted in the comment, you may either have `gofumpt` in your PATH or substitute the cexpr line above with the following (please make sure to replace `` with the path to your local gno repository): + +```vim +cexpr system('go run -modfile /misc/devdeps/go.mod mvdan.cc/gofumpt -w ' . expand('%')) +``` + #### Emacs Support 1. Install [go-mode.el](https://github.com/dominikh/go-mode.el).