Thanks to a previous answer, I can test if a file exists using
if !empty(glob("filename"))
...
endif
I now want to check if the file filename contains text text.
If possible, I want to do this using native vimscript only, not calling system’s grep etc commands.
See
:help function-listfor a high-level overview of vimscript functions.