editorconfig / editorconfig-vim

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

[Feature Request] Allow buffer local `EditorConfig_disable_rules` #185

Closed erikw closed 2 years ago

erikw commented 2 years ago

Hey,

I have a use case where I would like to disable trim_trailing_whitespace for a specific file in a project. It would be nice if we could do something like

autocmd BufRead  path/to/file.rb let b:EditorConfig_disable_rules = ['trim_trailing_whitespace']

and thus let the whitespace trimming be enabled in the other open buffers!

Currently only the global variable is considered https://github.com/editorconfig/editorconfig-vim/blob/3078cd10b28904e57d878c0d0dab42aa0a9fdc89/plugin/editorconfig.vim#L514

cxw42 commented 2 years ago

Thank you for using EditorConfig and for the idea! The normal way to do that would be to add, in path/to/.editorconfig:

[file.rb]
trim_trailing_whitespace = unset

Would you please try that first? If it doesn't work for some reason, let's discuss further. Thanks!

erikw commented 2 years ago

@cxw42 oh great! I'll try later today and report back.

erikw commented 2 years ago

This works fine, thanks!