I was trying to setup NeoVim to autosave each time a change is made. I used this command, which I wrote in
autocmd TextChanged, TextChangedI * silent write
It works perfectly for what I needed, but I found it to get in conflict with nerdtree, which I set-up with the following:
autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
Basically, it starts nerdtree at Vim start-up whenever I am not editing a specific file.
The error I am encountering is that the autosave command tries to save when I am in Nerdtree as well; for this reason, Vim gives the following error:
Error detected while processing TextChanged Autocommands for "*":
E382: Cannot write, 'buftype' option is set.
Press ENTER or type command to continue
Of course, if I press enter, it disappears, but whenever I press something to navigate in Nerdtree, it shows up again and it is very annoying.
Is there a way to fix this problem, maintaining the autosave?