Add haskell tools

This commit is contained in:
Maciej Jur 2023-07-10 15:18:34 +02:00
parent 36bd3ea0e9
commit a5c7553632
No known key found for this signature in database
GPG key ID: ADA3BF323198C639
4 changed files with 49 additions and 6 deletions

32
nvim/ftplugin/haskell.lua Normal file
View file

@ -0,0 +1,32 @@
local ht = require('haskell-tools')
local def_opts = { noremap = true, silent = true, }
ht.start_or_attach {
hls = {
on_attach = function(client, bufnr)
local opts = vim.tbl_extend('keep', def_opts, { buffer = bufnr, })
-- haskell-language-server relies heavily on codeLenses,
-- so auto-refresh (see advanced configuration) is enabled by default
vim.keymap.set('n', '<space>ca', vim.lsp.codelens.run, opts)
vim.keymap.set('n', '<space>hs', ht.hoogle.hoogle_signature, opts)
vim.keymap.set('n', '<space>ea', ht.lsp.buf_eval_all, opts)
end,
},
}
-- Suggested keymaps that do not depend on haskell-language-server:
local bufnr = vim.api.nvim_get_current_buf()
-- set buffer = bufnr in ftplugin/haskell.lua
local opts = { noremap = true, silent = true, buffer = bufnr }
-- Toggle a GHCi repl for the current package
vim.keymap.set('n', '<leader>rr', ht.repl.toggle, opts)
-- Toggle a GHCi repl for the current buffer
vim.keymap.set('n', '<leader>rf', function()
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
end, def_opts)
vim.keymap.set('n', '<leader>rq', ht.repl.quit, opts)
-- Detect nvim-dap launch configurations
-- (requires nvim-dap and haskell-debug-adapter)
-- ht.dap.discover_configurations(bufnr)

View file

@ -1,4 +1,5 @@
{
"haskell-tools.nvim": { "branch": "1.x.x", "commit": "2c8cb26417cb4ce6f4271efb72578576464a5424" },
"kanagawa.nvim": { "branch": "master", "commit": "1749cea392acb7d1548a946fcee1e6f1304cd3cb" },
"lazy.nvim": { "branch": "main", "commit": "da8b00581a52f5f87ad2aba9f52171fda7491f18" },
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },

View file

@ -16,6 +16,8 @@ return function()
"markdown",
-- nix
"nix",
-- haskell
"haskell",
-- latex
"latex", "bibtex",
-- misc

View file

@ -3,6 +3,14 @@ return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
{
"nvim-treesitter/nvim-treesitter",
config = require "configs/treesitter",
build = ":TSUpdate",
init = function()
vim.treesitter.language.register("markdown", "mdx")
end
},
{
"neovim/nvim-lspconfig",
config = require "configs/lspconfig",
@ -12,12 +20,12 @@ return {
config = require "configs/rust-tools",
},
{
"nvim-treesitter/nvim-treesitter",
config = require "configs/treesitter",
build = ":TSUpdate",
init = function()
vim.treesitter.language.register("markdown", "mdx")
end
"mrcjkb/haskell-tools.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
branch = "1.x.x",
},
{
"andweeb/presence.nvim",