Call the search function with the wrapping flag on

There's a (very improbable) user configuration that could make the
detection fail without this flag:
    autocmd BufReadPost * exe "normal! '\""
    set nowrapscan