Add haskell tools
This commit is contained in:
parent
36bd3ea0e9
commit
a5c7553632
32
nvim/ftplugin/haskell.lua
Normal file
32
nvim/ftplugin/haskell.lua
Normal 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)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"haskell-tools.nvim": { "branch": "1.x.x", "commit": "2c8cb26417cb4ce6f4271efb72578576464a5424" },
|
||||||
"kanagawa.nvim": { "branch": "master", "commit": "1749cea392acb7d1548a946fcee1e6f1304cd3cb" },
|
"kanagawa.nvim": { "branch": "master", "commit": "1749cea392acb7d1548a946fcee1e6f1304cd3cb" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "da8b00581a52f5f87ad2aba9f52171fda7491f18" },
|
"lazy.nvim": { "branch": "main", "commit": "da8b00581a52f5f87ad2aba9f52171fda7491f18" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
|
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
|
||||||
|
|
|
@ -16,6 +16,8 @@ return function()
|
||||||
"markdown",
|
"markdown",
|
||||||
-- nix
|
-- nix
|
||||||
"nix",
|
"nix",
|
||||||
|
-- haskell
|
||||||
|
"haskell",
|
||||||
-- latex
|
-- latex
|
||||||
"latex", "bibtex",
|
"latex", "bibtex",
|
||||||
-- misc
|
-- misc
|
||||||
|
|
|
@ -3,6 +3,14 @@ return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
dependencies = { "nvim-lua/plenary.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",
|
"neovim/nvim-lspconfig",
|
||||||
config = require "configs/lspconfig",
|
config = require "configs/lspconfig",
|
||||||
|
@ -12,12 +20,12 @@ return {
|
||||||
config = require "configs/rust-tools",
|
config = require "configs/rust-tools",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"mrcjkb/haskell-tools.nvim",
|
||||||
config = require "configs/treesitter",
|
dependencies = {
|
||||||
build = ":TSUpdate",
|
"nvim-lua/plenary.nvim",
|
||||||
init = function()
|
"nvim-telescope/telescope.nvim",
|
||||||
vim.treesitter.language.register("markdown", "mdx")
|
},
|
||||||
end
|
branch = "1.x.x",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"andweeb/presence.nvim",
|
"andweeb/presence.nvim",
|
||||||
|
|
Loading…
Reference in a new issue