autozimu / LanguageClient-neovim

Language Server Protocol (LSP) support for vim and neovim.
MIT License
3.55k stars 272 forks source link

Yank the result of hovering #1159

Closed roddyyaga closed 3 years ago

roddyyaga commented 3 years ago

Is there an easy way to yank the result of hovering? I have something hacky that waits until the preview window is open and jumps there but would prefer something more legitimate.

martskins commented 3 years ago

The dev branch uses specific names for the windows we use, so if you switch to the dev branch (have to build from source) you could do something like this:

function! YankHover(...)
  let @t = join(getbufline('__LCNHover__', 1, '$'),"\n")
endfunction

nmap <silent> <leader>K :call LanguageClient#textDocument_hover({ 'handle': v:true }, 'YankHover')<CR>

Where @t is the register t, so you'd paste with "tp. You can change that to the unnamed register or whatever you prefer though.

A release is due soon though, so in a few days that should also work in the next branch.

martskins commented 3 years ago

@roddyyaga I'm assuming this worked for you so I'm closing the issue. Feel free to re-open if it didn't though.