editorconfig / editorconfig-vim

EditorConfig plugin for Vim
http://editorconfig.org
Other
3.13k stars 137 forks source link

Patterns are matched incorrectly #151

Closed nedbat closed 4 years ago

nedbat commented 4 years ago

In my .editorconfig, I have this:

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
max_line_length = 120
trim_trailing_whitespace = true

[.git/*]
trim_trailing_whitespace = false

When I edit a file called "openedx_webhooks/tasks/github.py", it doesn't trim trailing whitespace.

This is because editorconfig-vim uses "=~" to decide if a filename matches a file pattern, but "=~" uses regexes, not glob-style patterns as you find in editorconfig files. The pattern ".git/*" should match any file in a directory called ".git", but since it is being interpreted as a regex, it matches any file with "git" in its name.

nedbat commented 4 years ago

My mistake, sorry!