With coc I used to be able to open the http link that appears in the hover text (produced by haskell-language-server in this case) by editing it with :normal commands. But when I switched to the builtin client, it doesn’t work because the popup window is read-only. So I copy the text into a register but the keybinding doesn’t work:
vim.cmd([[
function! s:open_documentation()
:lua vim.lsp.buf.hover()
:wincmd w
:normal G3k"dY
:wincmd c
:normal o
:normal "dp0c2f/http://localhost:8000
:normal 0gx
:normal dd
endfunction
noremap <leader>M <SID>open_documentation()
]])
When I run it, I get the d register set correctly [Documentation](file:///home/aavogt/.ghcup/ghc/9.8.2/share/doc/ghc-9.8.2/html/libraries/process-1.6.18.0-9c1a/System-Process.html#v:createProcess)
, but I can’t figure out how to get gx
to open the modified link http://localhost:8000/home/aavogt/.ghcup/ghc/9.8.2/share/doc/ghc-9.8.2/html/libraries/process-1.6.18.0-9c1a/System-Process.html#v:createProcess
. It would be better to :new and :quit, but :new doesn’t do anything from the function.