Reputation: 612
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?
Upvotes: 12
Views: 889
Reputation: 172598
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.
Upvotes: 4