In VSCode with the extension vscode-neovim
installed:
- How to set up the keybindings so that, for example, ctrl+u moves the screen a half-page up, and then centers it vertically?
- Vice-versa for down and full-page up/down.
I tried this in my keybindings.json
:
[
// disable the actual ctrl-u
{
"key": "ctrl+u",
"command": "-vscode-neovim.ctrl-u",
"when": "editorTextFocus && neovim.ctrlKeysNormal && neovim.init && neovim.mode != 'insert'"
},
// send the ctrl-u + z. for centering
{
"key": "ctrl+u",
"command": "vscode-neovim.send",
"when": "editorTextFocus && neovim.ctrlKeysNormal && neovim.init && neovim.mode != 'insert'",
"args": "<C-u>z."
},
]
But after these changes, half-page up and down commands now jump 100 lines (instead of 20 like before).
Related issue on GitHub: https://github.com/vscode-neovim/vscode-neovim/issues/1039
2
Answers
Problem
The problem seems to be related to the commented-out code from the
vscode-scrolling.vim
file:Workaround
I found a workaround for this problem, this involves setting the keymaps to execute both commands as a sequence:
Ctrl+d
andCtrl+u
with the following: