You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since vim already has settings that correspond to indent size and max line length, it would be great to have an option to hook those up to automatically match vim's 'shiftwidth' and 'textwidth' settings, since I've already configured formatting settings once and shouldn't be forced to repeat myself. There could be a single global setting to enable the feature and a buffer-local override so you could still work around corner cases.
The indent and line length settings will vary from formatter to formatter and support will need to be implemented per-formatter. It could either be explicitly part of the API or formatters could just check the relevant preferences and vim settings themselves in the formatter code.
The text was updated successfully, but these errors were encountered:
My naive preference would be to
a) Have a global (+local?) option to enable sending shiftwidth, textwidth, and other editor settings to formatters, and
b) Give custom .clang-format rules higher precedence.
The reason is that a lot of casual vim users don't configure shiftwidth, textwidth, etc. properly but will still expect codefmt to not cause formatting "regressions", like formatting based on their broken settings instead of custom project configuration.
Side note: http://editorconfig.org/ looks interesting and I'm wondering if we can consolidate some configuration with that somehow.
My concern is that it adds a new way for users to accidentally get formatting wrong. I'm just hoping to add an explicit opt-in or some heuristics to ensure the shiftwidth we're passing through to formatters is more trustworthy than the formatters' defaults first.
I gave this idea some more thought and I've decided this shouldn't be automated (though it could still be possible to manually configure flags to pass to formatters as in #66 or #24). You shouldn't get different formatting behavior if you invoke a tool from inside vim vs. standalone. EditorConfig is the ideal solution and Vim shouldn't be in the business of brokering style settings between configs and tools. Formatters tools should be able to detect and respect .editorconfig settings (e.g., google/yapf#826 for yapf).
Since vim already has settings that correspond to indent size and max line length, it would be great to have an option to hook those up to automatically match vim's 'shiftwidth' and 'textwidth' settings, since I've already configured formatting settings once and shouldn't be forced to repeat myself. There could be a single global setting to enable the feature and a buffer-local override so you could still work around corner cases.
The indent and line length settings will vary from formatter to formatter and support will need to be implemented per-formatter. It could either be explicitly part of the API or formatters could just check the relevant preferences and vim settings themselves in the formatter code.
The text was updated successfully, but these errors were encountered: