In vim, how to get rid of the annoying "E141: No file name for buffer nn"

This happens when I open an anonymous file from scratch and then do :wa

even if I close the buffer.

+4
source share
2 answers

Your own answer is simply a cure for the symptoms, not an elimination of the root cause.

It’s better to tell Vim correctly that your “zero buffer” (which, I assume, just agrees for you) is not meant to be saved. An option is used for this 'buftype'. Open the zero buffer with this (or create the appropriate mapping or command):

:new +setl\ buftype=nofile
+7
source

so you need to either save the buffer (and give it a name)

, , , vim :

:b nn " where nn = the errant buffer
:bd! " kill the scratch file

:h bd

+1

All Articles