Skip to content

Commit

Permalink
chore: add explanations about how to use gofumpt in vim (#747)
Browse files Browse the repository at this point in the history
Co-authored-by: grepsuzette <grepsuzette@users.noreply.github.com>
  • Loading branch information
grepsuzette and grepsuzette committed May 4, 2023
1 parent ff2189e commit 836f006
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 `<path/to/gno>` with the path to your local gno repository):

```vim
cexpr system('go run -modfile </path/to/gno>/misc/devdeps/go.mod mvdan.cc/gofumpt -w ' . expand('%'))
```

#### Emacs Support

1. Install [go-mode.el](https://github.com/dominikh/go-mode.el).
Expand Down

0 comments on commit 836f006

Please sign in to comment.