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
One issue here is that vim-codefmt is largely based on the assumption that a particular filetype has a single formatter that we can invoke to format (on save, or on :FormatCode, etc), while keep-sorted is an addition to (almost) any filetype.
While you can register a keep-sorted formatter yourself (it's not well-documented, but it is supported: you can get the codefmt registry from your own code via maktaba#extension#GetRegistry('codefmt'), and then add your own extension just as in plugin/register.vim), the problem you'll run into is that you'd always need to invoke it manually (i.e. :FormatCode keep-sorted), because :AutoFormatBuffer (to format-on-save) sets the default formatter as 'the' formatter for the buffer, as well as enabling format-on-save.
(Perhaps you could use something like autocmd BufWritePre cpp FormatCode keep-sorted? That's basically what :AutoFormatBuffer does, but it's a bit indirect.)
I think adding good support for something as general as keep-sorted probably requires solving #44 first, so that you configure a chain of formatters for a filetype to run (say) clang-format and then keep-sorted.
I'd like to have https://github.com/google/keep-sorted get invoked whenever I save a file, rather adopt https://pre-commit.com/
Could you include some instructions on how to do so?
The text was updated successfully, but these errors were encountered: