Say I want to match a buffer with no filename.

I can use the pattern *, then manually check the filename, like autocmd myVimrc BufEnter * if @% == "" | echom 'blank filename' | endif

Is there a pattern to match just blank filenames?

1 Answer 1


{} seems to work for just blank filenames.

Example: autocmd myVimrc BufEnter {} echom 'blank filename'. Much cleaner

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.