Vim
Vim copied to clipboard
vimdiff implementation when using `code --diff`
Is your feature request related to a problem? Please describe. I've been using VS Code vim and when launching the editor with --diff I expected it to work like vimdiff.
But it doesn't.
To start, no implementation is available for :diffget, :diffput and :diffupdate
There are also various other shortcuts for diff mode that would be nice ]c : - next difference [c : - previous difference do - diff obtain dp - diff put
Describe the solution you'd like Implementation of diff mode in vscodevim
Describe alternatives you've considered NA
Additional context NA
Vim supports using CTRL-W Left and CTRL-W Right to switch diff panes but not vscodevim. This is very useful for navigation and diff editing.
It appears that attempting "window switch" in vscodevim moves to other windows outside of the compare editor.
It appears that vscode itself does implement commands for switching panes: https://github.com/microsoft/vscode/issues/95068
Edit: The original comment suggested using vscode keybindings.json for the [c/]c mappings, but these broke commands such as ci] so I updated my suggestion to use regular vscode-vim mappings for them. Since it doesn't seem to be possible to define conditional mappings in vscode-vim I had to remove a small but nice addition suggested in the original comment.
settings.json additions that maps [c & ]c
"vim.normalModeKeyBindingsNonRecursive": [
{ "before": ["[", "c"], "commands": ["workbench.action.compareEditor.previousChange"] },
{ "before": ["]", "c"], "commands": ["workbench.action.compareEditor.nextChange"] },
}
Edit 2: The vscode keybindings.json additions below prevents Ctrl-W mappings from being registered by vim, so it appears that we're limited to vim mode bindings such as
{ "before": ["<c-w>", "d"], "commands": ["workbench.action.compareEditor.focusOtherSide"] },
keybindings.json additions that doesn't work:
{
"key": "ctrl+w ctrl+w",
"command": "workbench.action.compareEditor.focusOtherSide",
"when": "vim.active && vim.mode == 'Normal' && textCompareEditorActive"
},
{
"key": "ctrl+w h",
"command": "workbench.action.compareEditor.focusSecondarySide",
"when": "vim.active && vim.mode == 'Normal' && textCompareEditorActive"
},
{
"key": "ctrl+w l",
"command": "workbench.action.compareEditor.focusPrimarySide",
"when": "vim.active && vim.mode == 'Normal' && textCompareEditorActive"
},
{
"key": "ctrl+w left",
"command": "workbench.action.compareEditor.focusSecondarySide",
"when": "vim.active && vim.mode == 'Normal' && textCompareEditorActive"
},
{
"key": "ctrl+w right",
"command": "workbench.action.compareEditor.focusPrimarySide",
"when": "vim.active && vim.mode == 'Normal' && textCompareEditorActive"
},
Still on the look out for dp/do solutions, right now it doesn't seem like they're exposed as commands in vscode.