I usually keep *.in
files open in split and edit them. I would like vim to autosave the *.in
files whenever I switch between splits.
Searching other answers I found BufLeave
that suits my case. I have below in my .vimrc
:
autocmd BufLeave *.in :w!<cr>
But this gives below error when I switch out of the split that has a *.in
file open:
Error detected while processing BufLeave Auto commands for "*.in":
E13: File exists (add ! to override)
I am able to normally execute :w
and :w!
in the vim window successfully, but this auto save short cut is not working.
My vim details
$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 3 2019 04:38:39)
Included patches: 1-503, 505-680, 682-1283, 1365
Compiled by [email protected]
What could be the issue? Any help?
!
?