Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a keyboard shortcut to switch between the left-hand side and right-hand side of a diff/compare-two-files editor?

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?

like image 700
psquid Avatar asked Dec 18 '19 13:12

psquid


People also ask

What are the two shift keys on the keyboard for?

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.

What keyboard shortcuts can I use with my left hand?

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.

How do you switch from left to right on the keyboard?

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.

How do I switch my gun between left and right hand?

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"


1 Answers

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

like image 104
psquid Avatar answered Sep 28 '22 07:09

psquid