How do I check if a file is empty using vimscript?

Viewed 192

I have written my own linter in vimscript which lints a file using an external linting tool, and then reads the output into the quickfix window. I want to echo a message if there were no errors, but how can I check if that file is empty to do this?

1 Answers

Usually there's no need to check if temporary file is filereadable(). So only this should be enough:

if getfsize(tempname) < 1
    throw "cannot read temporary file"
endif
Related