My favorites | Sign in
Project Home Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 137: Snippets do not load from multiple locations in Windows (globpath() problem)
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----

Sign in to add a comment
Reported by, Jan 19, 2011
What steps will reproduce the problem?
1. Install snipMate in Windows (gVim 7.3)
2. Place your own "snippets" folder in c:\vim\vimfiles (or anywhere in your $RUNTIMEPATH)
3. No snippets are loaded.

Snippets will not be loaded in Windows if the first path in a list of paths ends in a backslash. See :h globpath, it reads:

"Note that on MS-Windows a directory may have a trailing backslash, remove it if you put a comma after it."

My quick and dirty fix for this issue is to amend the main snipMate.vim plugin file on line 24 where snippets_dir is set to read:

let snippets_dir = substitute(substitute(globpath(&rtp, 'snippets/'), "\n", ',', 'g'), 'snippets\\,', 'snippets,', 'g')

This substitutes "snippets\," with "snippets," which should only affect the found snippets directories that have additional paths following them. I'm sure there are scenarios where this doesn't do what it's supposed to depending on the circumstances.

A more thorough fix might inspect +shellslash and/or &shellslash to determine whether a replacement needs to be done.
Apr 13, 2011
Using the above fix gvim was complaining about loading snippets multiple times at startup.

I found that this worked for me:

let snippets_dir = '~/vimfiles/snippets,'
Sign in to add a comment

Powered by Google Project Hosting