Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable vim E211: File no longer available

Tags:

vim

macvim

After switching git branches, any files that existed on my previous branch raise an E211: File "path/to/file.txt" no longer available warning. I already know that and I find it very annoying that I'm warned about it every time I change the tab or pane that I'm focused on. Especially if I need to close 8 panes of files that no longer exist.

Is there any way to disable this warning or make it something that does not require any input to continue?

enter image description here

like image 850
James Klein Avatar asked Oct 12 '18 13:10

James Klein


1 Answers

You can tweak Vim's default behavior via the :help FileChangedShell event.

This autocommand is triggered for each changed file. [...] If a FileChangedShell autocommand is present the warning message and prompt is not given.

Unfortunately, by defining an :autocmd (e.g. invoking a no-op like an empty :execute), you'll lose all the default functionality, and would have to re-implement parts of it (without the message on deletion) by inspecing v:fcs_reason. If the sledgehammer approach is fine for you, this will do:

:autocmd FileChangedShell * execute

Instead of *, you could enumerate all of your Git working copies, to make this a bit more targeted.

like image 102
Ingo Karkat Avatar answered Oct 25 '22 04:10

Ingo Karkat