I love using VS Code with the vscode-vim extension as I can do most editing without the mouse. But whenever I'm looking at a diff view (by clicking a file with changes in the SCM/git pane) or an editor that's comparing two files (by running "Compare Active File With..." command), I need to use the mouse to switch between the left and right sides (i.e. the "old" and "new" versions of the change). This is annoying because I frequently compare two files and want to merge them by copying segments with changes from one file to the other, which needs me to switch back and forth in the compare view. Does anyone know if there's a keyboard shortcut, or a command I can bind a new keyboard shortcut to, for this?
Each keyboard has two shift keys and two ctrl keys, one of each on the right side and one of each on the left side. In Microsoft Office, when pressing the right shift and right ctrl at the same time the text shifts to left to right format, and when pressing the two on the right it shifts to right to left format.
Those who use a computer mouse with their left hand will be happy to know that common keyboard shortcuts like cut, copy and paste have alternatives on the right side of the keyboard. Usually, to cut/copy/paste, you would use the Ctrl+X, Ctrl+C, and Ctrl+V shortcuts, which are conducive to be used by the left hand.
On my system the settings are Ctrl+Shift+A → Left to Right; Ctrl+Shift+D → Right to Left. Don’t ask me why they didn’t use Ctrl+Shift+L and Ctrl+Shift+R instead (on looking at the keyboard I suddenly understood ;)), the first is unassigned (hint, hint), the second is assigned to Rulers, but you can change that easily.
Find below a bind to switch your gun between your left and right hand when the L key is pressed. Click the "Change Key" button to change the key this is bound to. Copy and paste the command into your developer console or autoexec to apply the bind. bind l "toggle cl_righthand 0 1"
Edit (Nov 11, 2020, thanks to @Mark):
workbench.action.compareEditor.focusPrimarySide
, workbench.action.compareEditor.focusSecondarySide
and workbench.action.compareEditor.focusOtherSide
have been added to VS Code. Should be in v1.52
It's an official feature request now, so please upvote it if you want to see this in VS Code: https://github.com/microsoft/vscode/issues/95068
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With