3

I would like to be able to scroll the YouComplete GetDoc popup with the keyboard in cases where the docstring is too large to fit within the popup. Currently I invoke the popup with <leader>yD. Here is the relevant snippet from my .vimrc:

nmap <leader>yd <plug>(YCMHover)
nnoremap <leader>yD :YcmCompleter GetDoc<CR>
let g:ycm_auto_hover = '' " disable auto popups

Here is an example of a docstring that is too large to fit within the popup:

enter image description here

Note that I am using mouse mode in tmux so my mouse scroll is bound to tmux and I'm after a keyboard-based solution. I am using vim 8.2.

quant
  • 21,507
  • 32
  • 115
  • 211

2 Answers2

1

From the docs

POPUP SCROLLBAR                     *popup-scrollbar*

If the text does not fit in the popup a scrollbar is displayed on the right of
the window.  This can be disabled by setting the "scrollbar" option to zero.
When the scrollbar is displayed mouse scroll events, while the mouse pointer
is on the popup, will cause the text to scroll up or down as you would expect.
A click in the upper half of the scrollbar will scroll the text down one line.
A click in the lower half will scroll the text up one line.  However, this is
limited so that the popup does not get smaller.

which makes me strongly believe that that scroll bar is meant to be interacted with via mouse.

Think that even YCM coauthor and maintainer just told me so (it's the wrong chat because I'm a bit slow at times).

Enlico
  • 23,259
  • 6
  • 48
  • 102
  • 1
    That's helpful thanks. This might be the least wrong answer to my question but I'm going to leave the bounty open for a bit in case someone finds a way to do it with the keyboard. – quant Jun 16 '22 at 02:59
0

Maybe you can try this on stackexchange. Although it mainly described for coc in nvim, since ycm also used popup window for DocString, so it also work.

The main idea is to get the current position of cursor, find the nearest popup window and change its firstline.

poohRui
  • 613
  • 5
  • 9