Closed
Description
Behavior
Anytime I add or delete a line that requires adding or deleting an import, my cursor gets moved when I save the file (when adding a line, my cursor gets moved up one line from where I was; when I delete a line, the cursor gets moved down a line, because goimports has added or removed lines). It would be nice if my cursor stayed locked to the same line of code I was on already, before saving.
Steps to reproduce:
- make sure to configure vim with
let g:go_fmt_command = "goimports"
- open a new Go file (using the default template)
- add a line after
fmt.Println("vim-go")
with the contents:
user := os.Getenv("user")
- position cursor on just-inserted line, at the
u
inuser
- save the file with
:w
Configuration
vimrc
contains onlylet g:go_fmt_command = "goimports"
- vim version: NVIM v0.2.1-15-g08b23d08
- vim-go version: bcf3f23
- go version: go1.8.2 darwin/amd64