From 02c752a943f90b7deffe335c0ac7f442cd316676 Mon Sep 17 00:00:00 2001 From: yannickreiss Date: Tue, 8 Oct 2024 10:07:17 +0200 Subject: [PATCH] Use fourmolu as Haskell formatter and fixer --- lua/confformat.lua | 14 ++++++++++++++ lua/linterconfiguration.lua | 1 + 2 files changed, 15 insertions(+) diff --git a/lua/confformat.lua b/lua/confformat.lua index 80d7226..2772620 100644 --- a/lua/confformat.lua +++ b/lua/confformat.lua @@ -43,6 +43,20 @@ require("formatter").setup({ require("formatter.filetypes.rust").rustfmt, }, + haskell = { + function() + -- Full specification of configurations is down below and in Vim help + -- files + return { + exe = "fourmolu", + args = { + util.escape_path(util.get_current_buffer_file_path()), + }, + stdin = true, + } + end, + }, + -- Use the special "*" filetype for defining formatter configurations on -- any filetype ["*"] = { diff --git a/lua/linterconfiguration.lua b/lua/linterconfiguration.lua index 58773a3..d351928 100644 --- a/lua/linterconfiguration.lua +++ b/lua/linterconfiguration.lua @@ -24,6 +24,7 @@ vim.g.ale_fixers = { markdown = { "prettier", "pandoc" }, python = { "yapf" }, pascal = { "ptop" }, + haskell = { "fourmolu" }, } vim.keymap.set("n", "lf", ":ALEFix")