开发者

Vim using gf with spaces in filenames

开发者 https://www.devze.com 2022-12-09 14:45 出处:网络
In gVim if the cursor is over a filename (like \"C:\\Program Files\\Vim\\vim71\\README.txt\" ) which contains spaces then using \'gf\' fails.

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 un开发者_如何学Goder these circumstances ?


You can select text in visual mode and then do a gf on it, that get's round the problem to some extent.


Another option is to use Windows' "8dot3" filenames. I've tested it out in Windows 7 + GVIM succesfully.

Find out the short filename by using the /X flag in the CMD prompt. You want to CD to the parent folder to that which has spaces in it. I'm not sure how to get the whole path at once in "8dot3" form.

Typing "cd " and then dragging from the Explorer's address bar to the CMD window can be easier than typing out the path:

> cd "C:\Users\Fabrice\Documents"
> dir /X

Then use it in Vim, eg:

C:\Users\Fabrice\Documents\MYGAME~1\Skyrim\SkyrimPrefs.ini

If using a folder instead of a file name, the path appears properly expanded in the Netrw listing (:Ex file list).

0

精彩评论

暂无评论...
验证码 换一张
取 消