A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/google/vim-codefmt/wiki/Formatter-Integration-Guide below:

Formatter Integration Guide · google/vim-codefmt Wiki · GitHub

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 plugin

TODO: Details

Adding a formatter into codefmt directly

The 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.

Why would I want to implement a separate extension plugin instead of adding the formatter into codefmt directly?

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