Skip to content
| Marketplace
Sign in
Visual Studio Code>Keymaps>Diff Vim NavigationNew to Visual Studio Code? Get it now.
Diff Vim Navigation

Diff Vim Navigation

Marcos Hernanz

| (0) | Free
Preserve useful Git diff navigation when using VSCodeVim.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Diff Vim Navigation

Preserve useful Git diff navigation when reviewing changes with VSCodeVim.

When you are in a VS Code Git diff editor:

  • gd can jump to a definition and keep a diff editor when the target file has meaningful changes.
  • Ctrl+O can jump back to the previous diff location.
  • Unchanged files and newly added files open as normal files instead of noisy whole-file diffs.

Requirements

This extension is designed for:

  • VS Code Git diff editors
  • VSCodeVim

Setup

The extension contributes the Ctrl+O keybindings itself.

For gd, add this VSCodeVim remap to your settings.json:

"vim.normalModeKeyBindingsNonRecursive": [
  {
    "before": ["g", "d"],
    "commands": [
      {
        "command": "diffVimNavigation.goToDeclarationPreserveDiff"
      }
    ]
  },
  {
    "before": ["g", "D"],
    "commands": [
      {
        "command": "diffVimNavigation.goToDeclarationPreserveDiff"
      }
    ]
  }
]

Do not bind g d in keybindings.json. VS Code treats g as a chord prefix in that case, which can break normal Vim commands such as gg.

Behavior

From a Git diff editor, gd asks VS Code's language providers for the target location and then opens the destination directly:

  • Modified tracked files open as Git diffs at the target location.
  • Unchanged files open as normal files at the target location.
  • Added or untracked files open as normal files at the target location.

Ctrl+O uses a small diff-local jump stack for jumps created by this extension, so returning from normal targets still lands back in the previous diff.

Limitations

This extension relies on VSCodeVim's command for jump-back navigation. If VSCodeVim changes its internal command names, Ctrl+O behavior may need an update.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft