aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxfzv <78810647+xfzv@users.noreply.github.com>2023-09-07 19:29:08 +0000
committerGitHub <noreply@github.com>2023-09-07 12:29:08 -0700
commit37a2d65bd2ee41540cc426d2cffef6d6f8648357 (patch)
tree70b02172bb09651ae32eac4a57577a4116578213
parent076ac4d7747bde487ed57ac96d0e1575a3bf720b (diff)
feat: add beautysh, taplo, trim_newlines and trim_whitespace (#29)
* feat: add beautysh * feat: add taplo * feat: add trim_newlines * feat: add trim_whitespace * doc: mention that `trim_newlines` and `trim_whitespaces` are using `awk` --------- Co-authored-by: xfzv <>
-rw-r--r--README.md4
-rw-r--r--lua/conform/formatters/beautysh.lua9
-rw-r--r--lua/conform/formatters/taplo.lua9
-rw-r--r--lua/conform/formatters/trim_newlines.lua9
-rw-r--r--lua/conform/formatters/trim_whitespace.lua9
5 files changed, 40 insertions, 0 deletions
diff --git a/README.md b/README.md
index f4657cb..8128927 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,7 @@ To view configured and available formatters, as well as to see the path to the l
- [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.
+- [beautysh](https://github.com/lovesegfault/beautysh) - A Bash beautifier for the masses.
- [black](https://github.com/psf/black) - The uncompromising Python code formatter.
- [clang_format](https://www.kernel.org/doc/html/latest/process/clang-format.html) - Tool to format C/C++/… code according to a set of rules and heuristics.
- [cljstyle](https://github.com/greglook/cljstyle) - Formatter for Clojure code.
@@ -189,7 +190,10 @@ To view configured and available formatters, as well as to see the path to the l
- [stylua](https://github.com/JohnnyMorganz/StyLua) - An opinionated code formatter for Lua.
- [swift_format](https://github.com/apple/swift-format) - Swift formatter from apple. Requires building from source with `swift build`.
- [swiftformat](https://github.com/nicklockwood/SwiftFormat) - SwiftFormat is a code library and command-line tool for reformatting `swift` code on macOS or Linux.
+- [taplo](https://github.com/tamasfe/taplo) - A TOML toolkit written in Rust
- [terraform_fmt](https://www.terraform.io/docs/cli/commands/fmt.html) - The terraform-fmt command rewrites `terraform` configuration files to a canonical format and style.
+- [trim_newlines](https://www.gnu.org/software/gawk/manual/gawk.html) - Trim new lines with `awk`
+- [trim_whitespace](https://www.gnu.org/software/gawk/manual/gawk.html) - Trim whitespaces with `awk`
- [uncrustify](https://github.com/uncrustify/uncrustify) - A source code beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and Vala.
- [xmlformat](https://github.com/pamoller/xmlformatter) - xmlformatter is an Open Source Python package, which provides formatting of XML documents.
- [yamlfix](https://github.com/lyz-code/yamlfix) - A configurable YAML formatter that keeps comments.
diff --git a/lua/conform/formatters/beautysh.lua b/lua/conform/formatters/beautysh.lua
new file mode 100644
index 0000000..4fe1bc1
--- /dev/null
+++ b/lua/conform/formatters/beautysh.lua
@@ -0,0 +1,9 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/lovesegfault/beautysh",
+ description = "A Bash beautifier for the masses.",
+ },
+ command = "beautysh",
+ args = { "-" }
+}
diff --git a/lua/conform/formatters/taplo.lua b/lua/conform/formatters/taplo.lua
new file mode 100644
index 0000000..675bed3
--- /dev/null
+++ b/lua/conform/formatters/taplo.lua
@@ -0,0 +1,9 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/tamasfe/taplo",
+ description = "A TOML toolkit written in Rust",
+ },
+ command = "taplo",
+ args = { "format", "-" },
+}
diff --git a/lua/conform/formatters/trim_newlines.lua b/lua/conform/formatters/trim_newlines.lua
new file mode 100644
index 0000000..4397ac7
--- /dev/null
+++ b/lua/conform/formatters/trim_newlines.lua
@@ -0,0 +1,9 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://www.gnu.org/software/gawk/manual/gawk.html",
+ description = "Trim new lines with awk",
+ },
+ command = "awk",
+ args = { 'NF{print s $0; s=""; next} {s=s ORS}' },
+}
diff --git a/lua/conform/formatters/trim_whitespace.lua b/lua/conform/formatters/trim_whitespace.lua
new file mode 100644
index 0000000..7178e0e
--- /dev/null
+++ b/lua/conform/formatters/trim_whitespace.lua
@@ -0,0 +1,9 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://www.gnu.org/software/gawk/manual/gawk.html",
+ description = "Trim whitespaces with awk",
+ },
+ command = "awk",
+ args = { '{ sub(/[ \t]+$/, ""); print }' },
+}