diff --git a/CHANGELOG.md b/CHANGELOG.md index 195e9d8059..bc18f3cef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ IMPROVEMENTS: * Add build tags (with `g:go_build_tags`) to all commands that support it. [[GH-1705]](https://github.com/fatih/vim-go/pull/1705) +* Some command which operate on files (rather than Vim buffers) will now show a + warning if there are unsaved buffers, similar to Vim's `:make`. + [[GH-1754]](https://github.com/fatih/vim-go/pull/1754) BUG FIXES: diff --git a/autoload/go/cmd.vim b/autoload/go/cmd.vim index 2aab4cc644..11e1d436e0 100644 --- a/autoload/go/cmd.vim +++ b/autoload/go/cmd.vim @@ -1,6 +1,17 @@ function! go#cmd#autowrite() abort if &autowrite == 1 || &autowriteall == 1 silent! wall + else + for l:nr in range(0, bufnr('$')) + if buflisted(l:nr) && getbufvar(l:nr, '&modified') + " Sleep one second to make sure people see the message. Otherwise it is + " often immediacy overwritten by the async messages (which also don't + " invoke the "hit ENTER" prompt). + call go#util#EchoWarning('[No write since last change]') + sleep 1 + return + endif + endfor endif endfunction