34 lines
1,011 B
Lua
34 lines
1,011 B
Lua
local map = require 'config.helpers.keymap'
|
|
local n = map 'n'
|
|
|
|
|
|
---@param buffer number
|
|
---@param ht HaskellTools
|
|
local function on_attach(_, buffer, ht)
|
|
n '<leader>hc' (vim.lsp.codelens.run) { 'Run codelens', buffer }
|
|
n '<leader>hs' (ht.hoogle.hoogle_signature) { 'Hoogle: search', buffer }
|
|
n '<leader>he' (ht.lsp.buf_eval_all) { 'Haskell: eval all', buffer }
|
|
|
|
local function repl_file()
|
|
local name = vim.api.nvim_buf_get_name(0)
|
|
ht.repl.toggle(name)
|
|
end
|
|
|
|
n '<leader>rf' (repl_file) 'Repl: Toggle GHCi for the current buffer'
|
|
n '<leader>rr' (ht.repl.toggle) { 'Repl: Toggle GHCi for the current package', buffer }
|
|
n '<leader>rq' (ht.repl.quit) { 'Repl: Quit', buffer }
|
|
|
|
-- Detect nvim-dap launch configurations
|
|
-- (requires nvim-dap and haskell-debug-adapter)
|
|
-- ht.dap.discover_configurations(bufnr)
|
|
end
|
|
|
|
---@type HTConfig
|
|
local config = {
|
|
hls = { on_attach = on_attach }
|
|
}
|
|
|
|
return function()
|
|
vim.g.haskell_tools = config
|
|
end
|