From 37a2d65bd2ee41540cc426d2cffef6d6f8648357 Mon Sep 17 00:00:00 2001 From: xfzv <78810647+xfzv@users.noreply.github.com> Date: Thu, 7 Sep 2023 19:29:08 +0000 Subject: 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 <> --- lua/conform/formatters/beautysh.lua | 9 +++++++++ lua/conform/formatters/taplo.lua | 9 +++++++++ lua/conform/formatters/trim_newlines.lua | 9 +++++++++ lua/conform/formatters/trim_whitespace.lua | 9 +++++++++ 4 files changed, 36 insertions(+) create mode 100644 lua/conform/formatters/beautysh.lua create mode 100644 lua/conform/formatters/taplo.lua create mode 100644 lua/conform/formatters/trim_newlines.lua create mode 100644 lua/conform/formatters/trim_whitespace.lua (limited to 'lua') 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 }' }, +} -- cgit v1.2.3-70-g09d2