如何启用“向上滚动”在代码建议/提示中使用 vscode vim 而不是使用箭头键?
VScodevim 默认情况下将 extension.vim_ctrl+j
映射到 Ctrl+j,这允许您向下导航弹出代码建议窗口(通过在插入模式下按 Ctrl+Space 触发) )像这样:
它还将 extension.vim_ctrl+k
映射到 Ctrl+k,但向下绑定不起作用,所以我无法向上滚动弹出-up 代码建议窗口。在插入模式下默认输入 digraph 但只需将类似的内容添加
{
"before": ["<C-k>"],
"after": ["extension.vim_ctrl+k"]
}
到我的 settings.json
不起作用,因为尽管它删除了有向图功能,但据我了解,每当我现在在插入模式下按 Ctrl+k 时,VSCode 都会查阅 settings.json
,找到到 的映射“extension.vim_ctrl+k”以某种无限循环的方式将其指向 settings.json
。
vim 中的 :h i_ctrl-j
显示此键绑定映射到“开始新行”,因此 VScode 似乎将“开始新行”解释为向下弹出窗口窗口处于插入模式,而不是像通常的 vim 行为那样创建新行并将光标移动到那里,尽管不确定这是如何工作的。无论如何,我找不到 VSCode 可以用来在弹出窗口中向上滚动的等效 vim 命令。任何帮助将不胜感激!
VScodevim has extension.vim_ctrl+j
by default mapped to Ctrl+j which allows you do navigate down pop-up code suggestion windows (triggered by hitting Ctrl+Space in insert mode) like this:
It also has extension.vim_ctrl+k
mapped to Ctrl+k but this binding down not work, so I cannot scroll up pop-up code suggestion windows. in insert mode defaults to entering a digraph but simply adding something like this
{
"before": ["<C-k>"],
"after": ["extension.vim_ctrl+k"]
}
to my settings.json
does not work since although it removes the digraph functionality, from what I understand, whenever I now press Ctrl+k in insert mode, VSCode will consult the settings.json
, find the mapping of to "extension.vim_ctrl+k" which points it back to settings.json
in a sort of infinite loop.
:h i_ctrl-j
in vim reveals this keybind to be mapped to "Begin new line" so it seems VScode interprets "Begin new line" as navigating down a pop-up window in insert mode instead of it's usual vim behaviour of creating a new line and moving the cursor there, although not sure this is how it works. In any case, I could not find an equivalent vim command that perhaps VSCode could use to scroll up in pop-up windows. Any help would be much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过复制
ctrl+p
和ctrl+n
的现有默认键绑定来完成此工作,默认情况下,这些键绑定在整个 VSCode 中用于上下滚动。我在
keybinds.json
文件中使用了alt
,但您可以轻松地将其替换为ctrl
来实现您想要的keybinds .json
I got this working by copying the existing default keybinds for
ctrl+p
andctrl+n
which are used throughout VSCode by default for scrolling up and down.I've used
alt
here in mykeybinds.json
file but you can easily replace it withctrl
to achieve what you wantkeybinds.json