aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarac <varac@users.noreply.github.com>2023-11-21 17:48:24 +0100
committerGitHub <noreply@github.com>2023-11-21 08:48:24 -0800
commitc0924a61e079d94f0be40da2d4188210c6e4ffea (patch)
tree6956da52b7ff8343f359c4fb420808dd489eabf4
parent2e5866a2c412a1237a9796a2d5a62d07fe084cc5 (diff)
feat: add beancount formatter (#212)
* feat: add beancount formatter * lint: remove unused require --------- Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
-rw-r--r--README.md3
-rw-r--r--lua/conform/formatters/bean-format.lua11
2 files changed, 13 insertions, 1 deletions
diff --git a/README.md b/README.md
index fbf7475..1f6b39c 100644
--- a/README.md
+++ b/README.md
@@ -181,6 +181,7 @@ You can view this list in vim with `:help conform-formatters`
- [auto_optional](https://auto-optional.daanluttik.nl/) - Adds the Optional type-hint to arguments where the default value is None.
- [autoflake](https://github.com/PyCQA/autoflake) - Removes unused imports and unused variables as reported by pyflakes.
- [autopep8](https://github.com/hhatto/autopep8) - A tool that automatically formats Python code to conform to the PEP 8 style guide.
+- [bean-format](https://beancount.github.io/docs/running_beancount_and_generating_reports.html#bean-format) - Format [Beancount](https://beancount.github.io/) files.
- [beautysh](https://github.com/lovesegfault/beautysh) - A Bash beautifier for the masses.
- [bibtex-tidy](https://github.com/FlamingTempura/bibtex-tidy) - Cleaner and Formatter for BibTeX files.
- [biome](https://github.com/biomejs/biome) - A toolchain for web projects, aimed to provide functionalities to maintain them.
@@ -515,7 +516,6 @@ Retrieve the available formatters for a buffer
`list_all_formatters(): conform.FormatterInfo[]` \
List information about all filetype-configured formatters
-
### get_formatter_info(formatter, bufnr)
`get_formatter_info(formatter, bufnr): conform.FormatterInfo` \
@@ -534,6 +534,7 @@ Check if the buffer will use LSP formatting when lsp_fallback = true
| Param | Type | Desc |
| ------- | ------------ | ------------------------------------ |
| options | `nil\|table` | Options passed to vim.lsp.buf.format |
+
<!-- /API -->
## Acknowledgements
diff --git a/lua/conform/formatters/bean-format.lua b/lua/conform/formatters/bean-format.lua
new file mode 100644
index 0000000..c985bfa
--- /dev/null
+++ b/lua/conform/formatters/bean-format.lua
@@ -0,0 +1,11 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://beancount.github.io/docs/running_beancount_and_generating_reports.html#bean-format",
+ description = "Reformat Beancount files to right-align all the numbers at the same, minimal column.",
+ },
+ command = "bean-format",
+ args = {
+ "-",
+ },
+}