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

40 lines
1 KiB
Lua
Raw Normal View History

2023-09-04 23:01:56 +02:00
local nmap = require("utility").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
2023-10-29 09:47:39 +01:00
---@param config table
---@return table
return function(config)
return vim.tbl_extend("keep", config, M)
end