treyhunner/editorconfig-vim — Issue #2: Fix file pattern to work like .gitignore files
Author: treyhunner
Created: 2011-10-20 15:45:27+00:00
State: open

The following 3 bullet points from [the .gitignore manpage](http://manpages.ubuntu.com/manpages/natty/man5/gitignore.5.html#contenttoc3) should apply to editorconfig file matching as well.

* If the pattern does not contain a slash /, git treats it as a shellglob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).
* Otherwise, git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. For example, "Documentation/*.html" matches "Documentation/git.html" but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html".
* A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".

The vim `globpath` command should be used instead of `glob` because it works similarly to [fnmatch](http://manpages.ubuntu.com/manpages/natty/man3/fnmatch.3.html).