Fugitive for VS Code

December 12, 2025 ยท View on GitHub

This is a simple extension that adds a subset of the fugitive plugin to VS Code.

This extension is meant to be used with the vscodevim.vim plugin. You can register the fugitive.open as a vim mapping like the following in your settings.json:

  "vim.normalModeKeyBindings": [
    {
      // Opens the Fugitive UI
      "before": [ "<Leader>", "g", "s" ],
      "commands": [ "fugitive.open" ]
    },
    ///...
  ]

Keymaps

The following table shows the available keymaps. Keymaps with an asterisk are done with a VS Code specific customization. The default mappings assume QUERTZ as the keyboard layout. See below for how to configure different layouts.

CommandKeymappingDescription
fugitive.stagesStage (add) the file or hunk under the cursor.
fugitive.unstageuUnstage (reset) the file or hunk under the cursor.
fugitive.toggle-Stage or unstage the file or hunk under the cursor.
fugitive.unstageAllUUnstage everything.
fugitive.cleanXDiscard the change under the cursor.
fugitive.toggleInlineDiffshift+0 (QUERTZ: =)Toggle an inline diff on the file under the cursor.
fugitive.openDiffd vOpens the change under the cursor in a vertical split.
fugitive.commitc cCreate a commit.
fugitive.amendc aAmend the last commit and edit the message.
fugitive.amendNoEditc eAmend the last commit without editing the message.
fugitive.stashc z zPush stash.
fugitive.stashStagedc z sPush stash of the stage.
fugitive.popLatestStashc z PPop topmost stash.
fugitive.popStash*c z pPop a selected stash.
fugitive.checkoutBranch*c o bCheckout a selected branch.
fugitive.goUntrackedg uJump to the Untracked / Unstaged section.
fugitive.goUnstagedg UJump to the Unstaged section.
fugitive.goStagedg sJump to the Staged section.
fugitive.goUnpushedg pJump to the Unpushed section.
fugitive.gitExclude*g iOpen .git/info/exclude. Add the file under the cursor.
fugitive.gitIgnore*g IOpen .gitignore. Add the file under the cursor
fugitive.openFileOOpen the file under the cursor in a new tab.
fugitive.openFileSplitoOpen the file under the cursor in a new split.
fugitive.previousHunkshift+8 (QUERTZ: '(')Jump to the previous hunk.
fugitive.nextHunkshift+9 (QUERTZ: ')')Jump to the next hunk.
fugitive.helpg hOpen the README of this extension
fugitive.closeg qClose Fugitive
fugitive.refreshg rRefresh the git status
fugitive.toggleViewg tToggle between the tree and list view
fugitive.toggleDirectoryg fOpen/Close a directory fold in tree view
fugitive.setRepositorySwitch between multiple subrepositories
fugitive.diffviewFugitive: Open DiffView
fugitive.diffviewChooseBranchFugitive: Open DiffView and Choose Branch
fugitive.diffviewOpenFileoEnters a file in DiffView

Additionally, j/k are mapped to up/down in non vim mode.

Using different keyboard layouts

To change the keymapping to i.e. QUERTY the following entry needs to be added to the keyboard.json

{
"command": "fugitive.toggleInlineDiff",
"key": "=",
"when": "(vim.mode == 'Normal' || !vim.mode) && resourceScheme == fugitive && editorTextFocus"
}
{
"command": "fugitive.previousHunk",
"key": "shift+9",
"when": "(vim.mode == 'Normal' || !vim.mode) && resourceScheme == fugitive && editorTextFocus"
}
{
"command": "fugitive.nextHunk",
"key": "shift+0",
"when": "(vim.mode == 'Normal' || !vim.mode) && resourceScheme == fugitive && editorTextFocus"
}
# ...

Out of scope

  1. At the moment the vim extension does not support registering custom commands. Hence the Git statusline commands are not part of this scope. If you are interested in this functionality, i have opened an issue on the vim extension github here.
  2. The vscode git api does not have first-class support for interactive rebasing. Therefore, functionality relying on rebasing is not provided in this extension.

Issues and Feature Requests

Did you encounter issues or errors? Please file an issue on this repository and add the stacktrace from the Fugitive Output Channel. Are there features you would like to see? Feel free to file an issue or provide a pull request.