If you have a formatter codefmt doesn't support that you want to integrate with codefmt, you have two choices:
For robust, publicly available formatters, adding them directly into codefmt is usually fine. See the FAQ for reasons to go with one approach over the other.
Writing an extension pluginTODO: Details
Adding a formatter into codefmt directlyThe first step for integrating a new formatter with codefmt directly is always to file a feature request for your formatter at https://github.com/google/vim-codefmt/issues if one hasn't already been filed.
Next, read through :help codefmt
, have a look at the other formatters implemented in autoload/codefmt.vim for inspiration, and get started implementing the formatter API.
TODO: Specifics
Why integrate it with codefmt? Why not just shell out to the formatter with:%!SOMEFORMATTER
?
Codefmt formatters work better in a lot of corner cases and support several nice features like
The quick and dirty :%!SOMEFORMATTER
approach also won't have any error handling. Once you add error handling and such, the advantages of the quick and dirty approach vs. a codefmt formatter are less obvious.
The main reasons are if the formatter isn't ready for wide adoption, if it has dependencies that are hard to install, or if it's a special-purpose/proprietary formatter.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4