简体   繁体   English

如何使用键盘滚动 YouCompleteMe GetDoc 弹出窗口?

[英]How do I scroll the YouCompleteMe GetDoc popup with the keyboard?

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.如果文档字符串太大而无法容纳在弹出窗口中,我希望能够使用键盘滚动 YouComplete GetDoc弹出窗口。 Currently I invoke the popup with <leader>yD .目前我用<leader>yD调用弹出窗口。 Here is the relevant snippet from my .vimrc :这是我的.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:这是一个文档字符串的示例,它太大而无法放入弹出窗口:

在此处输入图像描述

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.请注意,我在 tmux 中使用鼠标模式,因此我的鼠标滚动绑定到 tmux,并且我正在使用基于键盘的解决方案。 I am using vim 8.2 .我正在使用vim 8.2

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).想想即使是 YCM 的合著者和维护者也只是告诉我(这是错误的聊天,因为我有时有点慢)。

Maybe you can try this on stackexchange .也许你可以在stackexchange上试试这个。 Although it mainly described for coc in nvim, since ycm also used popup window for DocString, so it also work.虽然它主要针对 nvim 中的 coc 进行描述,但由于 ycm 也使用弹出 window 来表示 DocString,所以它也可以工作。

The main idea is to get the current position of cursor, find the nearest popup window and change its firstline.主要思路是获取cursor的当前position,找到最近的弹出窗口window并更改其第一行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM