editorconfig / editorconfig-vim

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

Changing settings of existing files causes some issues #177

Open fedorenchik opened 3 years ago

fedorenchik commented 3 years ago

When working on multiple new and existing projects automatic changing of settings can get in a way.

For example, I want new projects use settings from $HOME/.editorconfig, and existing projects (which maybe without any local .editorconfig file) keep existing settings (specifically, fileformat).

Let's say, in $HOME/.editorconfig:

end_of_line = lf

and existing projects has dos-style line endings.

Then, automatic changing of fileformat has 2 problems:

  1. When opening a file user do not know real line ending of the file (set ff? would always return unix)
  2. It is impossible to change line ending of a file from within vim (without some hackery, such as set ff=dos | set ff=unix)

Maybe other settings have the same issue (such as insert_final_newline).

Thus, I propose to not change settings of existing files (or at least don't set settings from .editorconfig where root = true).

cxw42 commented 3 years ago

@fedorenchik thanks for using the plugin and reporting! I think you are saying that, in some cases, if you add a .editorconfig to a project but the files in that project don't match the settings in the .editorconfig, the plugin doesn't make Vim change those files. Is that correct or not?

To help us understand the problem:

Much appreciated!