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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With