In a Jekyll file I have

 <IMG SRC="/assets/images/

I would like to use the filename autocompletion shortcut to insert the rest of the filename, but this fails because of the leading slash.

When I remove the leading slash, the completion works perfectly but I then I have to put it back in for the code to work.

How can I tell vim to ignore the slash?

Related question is this one but the solutions do not appear relevant.

  • 2
    Fwiw it’s not usually necessary to write jekyll links that way (one of the template params is site.url or something similar. You can also use {% link file %}, which works with relative paths!)
    – D. Ben Knoble
    Jan 26, 2021 at 13:17
  • I don't think there's really any way to do this without overriding the <C-x><C-f> logic to implement your own, or using completefunc. See How to create my own autocomplete function? The help page says "Note: the 'path' option is not used here (yet)", so the "real solution" would probably be to implement that in Vim. Jan 26, 2021 at 20:34
  • @D.BenKnoble - oooh, will check that out (although I still find the question interesting)
    – Joe
    Jan 27, 2021 at 11:59


Your Answer

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

Browse other questions tagged or ask your own question.