From f40584b6a9021a90f51783c28e20446b63f33f3e Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Wed, 3 Jun 2020 12:35:15 +0530 Subject: [PATCH] nvim: Enable LSP support for Haskell With ghcide release v0.2.0 adding multi-component support this should work more widely now. We still can have tags, so change the key binding for jump to definition and drop key binding K for Hoogle. Signed-off-by: Sanchayan Maity --- nvim/.config/nvim/after/ftplugin/haskell.vim | 1 - nvim/.config/nvim/lua/lsp.lua | 4 ++-- nvim/.config/nvim/plugin_settings.vim | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim/.config/nvim/after/ftplugin/haskell.vim b/nvim/.config/nvim/after/ftplugin/haskell.vim index 9a43f48..1c9da9f 100644 --- a/nvim/.config/nvim/after/ftplugin/haskell.vim +++ b/nvim/.config/nvim/after/ftplugin/haskell.vim @@ -2,7 +2,6 @@ " https://github.com/maxigit/vimrc/tree/2020/compiler compiler stack setlocal makeprg=stack\ build -setlocal keywordprg=:Hoogle nmap t :AsyncDo stack exec -- hasktags -x -c . nmap td :AsyncDo stack exec -- haskdogs diff --git a/nvim/.config/nvim/lua/lsp.lua b/nvim/.config/nvim/lua/lsp.lua index 3508062..2605564 100644 --- a/nvim/.config/nvim/lua/lsp.lua +++ b/nvim/.config/nvim/lua/lsp.lua @@ -6,7 +6,7 @@ local on_attach = function(_, bufnr) require'completion'.on_attach() local opts = { noremap=true, silent=true } - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.util.show_line_diagnostics()', opts) @@ -19,7 +19,7 @@ local on_attach = function(_, bufnr) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) end -local servers = { 'rust_analyzer' } +local servers = { 'ghcide', 'rust_analyzer' } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, diff --git a/nvim/.config/nvim/plugin_settings.vim b/nvim/.config/nvim/plugin_settings.vim index 4a03506..78d9212 100644 --- a/nvim/.config/nvim/plugin_settings.vim +++ b/nvim/.config/nvim/plugin_settings.vim @@ -82,6 +82,7 @@ let g:completion_chain_complete_list = { \ {'mode': ''} \], \ 'haskell': [ + \ {'complete_items': ['lsp']}, \ {'mode': 'keyn'}, \ {'mode': 'tags'}, \ {'mode': ''},