Vim Can't Save File (E212)
macos, vim
Solution
This will ask you for the root password, then save your changes as you requested:
:w !sudo tee %
Then type (L)oad at the prompt, to re-load the file after it is saved.
Problem
Sometimes when I create a file using `vim some/path/newfile`, vim lets me edit it, only to complain when I attempt to save my changes. ``` E212 Can't open file for writing. ``` This appears to happen only when the new file is located in a system directory. `:w!` does not override this error. How can I write the current buffer, without having to save it to a temporary location, exit, then rename it using sudo?