Add elixir-tools.nvim

Mon, 26 Jun 2023 14:10:36 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 26 Jun 2023 14:10:36 -0500
changeset 1121
199d907c2f67
parent 1120
8f8a93daa98c
child 1122
8a56361b077f

Add elixir-tools.nvim

.config/nvim/lua/plugins/filetype.lua file | annotate | diff | comparison | revisions
--- a/.config/nvim/lua/plugins/filetype.lua
+++ b/.config/nvim/lua/plugins/filetype.lua
@@ -39,4 +39,35 @@ return {
   "asciidoc/vim-asciidoc",
   { "vim-perl/vim-perl", branch = "dev" },
   "yko/mojo.vim",
+
+  -- Because of Elixir/OTP mismatches, this is more reliable than Mason for
+  -- elixir-ls
+  {
+    "elixir-tools/elixir-tools.nvim",
+    version = "*",
+    event = { "BufReadPre", "BufNewFile" },
+    config = function()
+      local elixir = require("elixir")
+      local elixirls = require("elixir.elixirls")
+
+      elixir.setup({
+        credo = {},
+        elixirls = {
+          enable = true,
+          settings = elixirls.settings({
+            dialyzerEnabled = false,
+            enableTestLenses = false,
+          }),
+          on_attach = function(client, bufnr)
+            vim.keymap.set("n", "<leader>fp", ":ElixirFromPipe<cr>", { buffer = true })
+            vim.keymap.set("n", "<leader>tp", ":ElixirToPipe<cr>", { buffer = true })
+            vim.keymap.set("v", "<leader>em", ":ElixirExpandMacro<cr>", { buffer = true })
+          end,
+        },
+      })
+    end,
+    dependencies = {
+      "nvim-lua/plenary.nvim",
+    },
+  },
 }

mercurial