4

Occasionally, when writing shell scripts and such, I have entries of the form:

foo=/bar/baz

To get filename completion (<C-x> <C-f>) to work, I have to put a space after the =, and then remove it after completion. I don't have any filenames which contain =, so I don't care about it being part of the completion. How do I get it to work with the =? I use Linux primarily, but Windows on occasion too.

9

The list of valid filename characters is given by the isfname variable. From :he 'isfname':

'isfname' 'isf'     string  (default for MS-DOS, Win32 and OS/2:
                         "@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,="
                        for AMIGA: "@,48-57,/,.,-,_,+,,,$,:"
                        for VMS: "@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~"
                        for OS/390: "@,240-249,/,.,-,_,+,,,#,$,%,~,="
                        otherwise: "@,48-57,/,.,-,_,+,,,#,$,%,~,=")

To make Vim ignore = as a filename character, remove = from this list:

:set isfname-==

Now, completion should work for foo=/ba....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.