Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change side in diff mode #3979

Closed
joelazar opened this issue Aug 12, 2019 · 9 comments
Closed

Change side in diff mode #3979

joelazar opened this issue Aug 12, 2019 · 9 comments

Comments

@joelazar
Copy link

I'm not really sure that it's a bug or a non-existent feature yet, but in diff mode by default when I'm focusing the window the editor focuses on the right side of it (the current version of the file) and I thought that would be reasonable to change side by ctrl+ww, but unfortunately it's not working.

However, If I change the focus by clicking (😢) to the left side of the window (to the previous version of the file) then by the same action (ctrl+ww) works fine and does change the focus the the right side.

Extension (VsCodeVim) version: 1.9.0
VSCode version: 1.37
OS: Windows 10 1809

@J-Fields
Copy link
Member

Seems like an upstream problem to me. workbench.action.focusLeftGroup does not focus the left side while workbench.action.focusRightGroup focuses the right side. @joelazar would you mind filing an issue with VSCode?

@joelazar
Copy link
Author

Thank you very much for you help. I've filed an issue to VSCode.

@joelazar
Copy link
Author

And it already got closed 😢

@dcervenkov
Copy link

The necessary command workbench.action.compareEditor.focusOtherSide was added upstream; see microsoft/vscode#95068 (comment). Could you, therefore, reopen this issue?

@dcervenkov
Copy link

Until this is resolved in VSCodeVim, the following keybinding is a simple workaround

    {
        "key": "ctrl+w ctrl+w",
        "command": "workbench.action.compareEditor.focusOtherSide",
        "when": "textCompareEditorActive"
    }

This keeps <C-w><C-w> working as expected outside of diff windows and switches exclusively between the two sides of a diff window when it is active.

@mogelbrod
Copy link
Contributor

mogelbrod commented Aug 10, 2022

Adding on to @dcervenkov s suggestion, here's a few more custom keybindings I suggest to get the experience closer to regular vim: #4942 (comment)

Edit: It appears that the mapping by @dcervenkov prevents vim from picking up other Ctrl-W bindings while in the compare editor 😢

@7vq
Copy link

7vq commented Feb 4, 2023

workbench.action.compareEditor.focusOtherSide also seems to sometimes "save" different cursor positions for each side in the compare window, which I don't recall ever seeing in vim and I don't think I ever want. In other words, sometimes just calling that command toggles me between two different locations in the two files. Both views update in sync, but I don't want the files to scroll around at all just by me changing the window focus.

@weeklyTea
Copy link

I solved the problem for myself by adding next snippet to settings.json:

"vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": [ "<C-w>", "h" ],
      "commands": [{
          "command": "workbench.action.compareEditor.focusSecondarySide"
      }]
    },
    {
      "before": [ "<C-w>", "l" ],
      "commands": [{
          "command": "workbench.action.compareEditor.focusPrimarySide"
      }]
    }
]

It enable Ctrl+w h combination to switch to the left side and Ctrl+w l to the right one.

@mogelbrod
Copy link
Contributor

I solved the problem for myself by adding next snippet to settings.json:

That ought to break the Ctrl+w h / Ctrl+w l mappings to navigate between splits?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants