dotfiles/nvim/lua/plugins/haskell-tools.lua

36 lines
959 B
Lua
Raw Normal View History

local nmap = require("utility").curried_keymap('n')
2023-08-20 14:27:47 +02:00
local M = {}
2023-07-23 01:34:24 +02:00
function M.init()
vim.g.haskell_tools = {
2023-07-23 01:34:24 +02:00
hls = {
on_attach = function(_, buffer, ht)
nmap "<leader>hs" (ht.hoogle.hoogle_signature) {"Hoogle: search", buffer}
nmap "<leader>ha" (ht.lsp.buf_eval_all) {"Haskell: eval all", buffer}
end
}
2023-07-23 01:34:24 +02:00
}
end
function M.config()
local ht = require "haskell-tools"
local buffer = vim.api.nvim_get_current_buf()
2023-07-23 01:34:24 +02:00
local function repl_file()
local name = vim.api.nvim_buf_get_name(0)
ht.repl.toggle(name)
end
2023-07-23 01:34:24 +02:00
nmap "<leader>rr" (ht.repl.toggle) {"Repl: Toggle GHCi for the current package", buffer}
nmap "<leader>rf" (repl_file) "Repl: Toggle GHCi for the current buffer"
nmap "<leader>rq" (ht.repl.quit) {"Repl: Quit", buffer}
2023-07-23 01:34:24 +02:00
-- Detect nvim-dap launch configurations
-- (requires nvim-dap and haskell-debug-adapter)
-- ht.dap.discover_configurations(bufnr)
end
2023-08-20 14:27:47 +02:00
return M