How to use "gf" on filenames containing spaces in gVim?


In gVim if the cursor is over a filename (like “C:\Program Files\Vim\vim71\README.txt” ) which contains spaces then using ‘gf’ fails.

I found the isfname option but the documentation says one should avoid using spaces.

Is there I can make gVim open files under these circumstances ?


Select the text in visual mode, then do a gf on it. That gets around the problem to some extent.

Answered By – Benj

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published