aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Coene <jcoenep@gmail.com>2023-11-10 16:10:51 +0100
committerGitHub <noreply@github.com>2023-11-10 07:10:51 -0800
commit6afc64e9f36cbae35c2a8b6852d0b91c9807a72a (patch)
tree0a12451a46a06258e8bdc72aa06fe6ef5fbe147c
parentc3447c0080f4d6a94917b6eefa2dbdcac63dbfcc (diff)
feat: add styler formatter for R (#184)
* feat: add styler formatter for R * fix: do not run --vanilla to pick up options * docs: add to README * fix: std in false * fix: do not hardcode style, use config file * fix: lint styler formatter
-rw-r--r--README.md1
-rw-r--r--lua/conform/formatters/styler.lua11
2 files changed, 12 insertions, 0 deletions
diff --git a/README.md b/README.md
index 175ed6d..5693756 100644
--- a/README.md
+++ b/README.md
@@ -257,6 +257,7 @@ You can view this list in vim with `:help conform-formatters`
- [standardjs](https://standardjs.com) - JavaScript Standard style guide, linter, and formatter.
- [standardrb](https://github.com/standardrb/standard) - Ruby's bikeshed-proof linter and formatter.
- [stylelint](https://github.com/stylelint/stylelint) - A mighty CSS linter that helps you avoid errors and enforce conventions.
+- [styler](https://github.com/devOpifex/r.nvim) - A formatter for the R programming language.
- [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.
diff --git a/lua/conform/formatters/styler.lua b/lua/conform/formatters/styler.lua
new file mode 100644
index 0000000..d9052c1
--- /dev/null
+++ b/lua/conform/formatters/styler.lua
@@ -0,0 +1,11 @@
+local util = require("conform.util")
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/devOpifex/r.nvim",
+ description = "R formatter and linter.",
+ },
+ command = util.find_executable({ "usr/bin/" }, "R"),
+ args = { "-s", "-e", "r.nvim::format()", "--args", "$FILENAME" },
+ stdin = false,
+}