]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/nvim/lua/plugins/haskell-tools.lua
Usability/Operability(neovim/gitsigns): enable
[julm/julm-nix.git] / home-manager / profiles / nvim / lua / plugins / haskell-tools.lua
1 -- If you are starting out with Haskell, nvim-lspconfig.hls is probably enough for you.
2 -- It provides the lowest common denominator of LSP support.
3 -- This plugin is for those who would like additional features
4 -- that are specific to Haskell tooling.
5 -- https://github.com/MrcJkb/haskell-tools.nvim
6 return {
7 "haskell-tools.nvim",
8 lazy = false,
9 after = function()
10 -- This is a filetype plugin that works out of the box,
11 -- so there is no need to call a setup function or configure anything
12 -- to get this plugin working.
13 vim.g.haskell_tools = {
14 tools = {
15 hover = {
16 enable = true,
17 },
18 },
19 hls = {
20 cmd = { "haskell-language-server-wrapper", "--lsp" },
21 enable = false,
22 filetypes = { "haskell", "lhaskell" },
23 on_attach = function(client, bufnr)
24 local ht = require("haskell-tools")
25 local opts = { noremap = true, silent = true, buffer = bufnr }
26 vim.keymap.set("n", "<localleader>cl", vim.lsp.codelens.run, opts)
27 vim.keymap.set("n", "<localleader>hs", ht.hoogle.hoogle_signature, opts)
28 vim.keymap.set("n", "<localleader>ea", ht.lsp.buf_eval_all, opts)
29 vim.keymap.set("n", "<localleader>rr", ht.repl.toggle, opts)
30 vim.keymap.set("n", "<localleader>rf", function()
31 ht.repl.toggle(vim.api.nvim_buf_get_name(0))
32 end, opts)
33 vim.keymap.set("n", "<localleader>rq", ht.repl.quit, opts)
34 end,
35 root_dir = function(bufnr, on_dir)
36 local fname = vim.api.nvim_buf_get_name(bufnr)
37 on_dir(
38 util.root_pattern("hie.yaml", "stack.yaml", "cabal.project", "*.cabal", "package.yaml")(fname)
39 )
40 end,
41 settings = { haskell = { cabalFormattingProvider = "cabalfmt", formattingProvider = "fourmolu" } },
42 },
43 }
44 end,
45 }