I am looking for an elegant way in vimscript to check if a file exists in the current directory in a function.
I came up with this, but I'm not sure if this is the most elegant solution (I will set the vim option if it exists) - is there a way to not do another file name comparison - maybe use different vim built-in function (?):
:function! SomeCheck() : if findfile("SpecificFile", ".") == "SpecificFile" : echo "SpecificFile exists" : endif :endfunction
vim file-exists
stefanB Jun 23 2018-10-06T00: 00Z
source share