Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save seanfisher/e6424d539f3b4e6e10ffa21e34149d94 to your computer and use it in GitHub Desktop.

Select an option

Save seanfisher/e6424d539f3b4e6e10ffa21e34149d94 to your computer and use it in GitHub Desktop.
Open Repository in VS Code from Sublime Merge

Open Repository in VS Code from Sublime Merge

This gist adds a command to Sublime Merge that opens the current repository in Visual Studio Code, accessible from:

  • The Command Palette
  • The top menu bar (Repository menu)
  • The toolbar “…” (Action) menu

Because Sublime Merge custom commands are limited to invoking git, this solution uses a Git alias that shells out to the VS Code CLI.

Files Included

.gitconfig

Adds a Git alias:

[alias]
    vscode = "!code ."

This allows git vscode to open the current repository in VS Code.

Default.sublime-commands

Adds a Command Palette entry: Open Repository in VS Code

Main.sublime-menu

Adds the same action to the top menu bar (Repository menu).

Action.sublime-menu

Adds the action to the toolbar “…” menu.

Installation

  1. Ensure VS Code CLI is installed

In VS Code: Command Palette → Shell Command: Install 'code' command in PATH

  1. Install the Git alias

Merge the provided .gitconfig snippet into your ~/.gitconfig.

  1. Install Sublime Merge files

In Sublime Merge:

  • Windows: Preferences → Browse Packages…
  • Mac: Sublime Merge main menu → Settings… → Browse Packages…

Copy the .sublime-commands and .sublime-menu files into: Packages/User/

  1. Restart Sublime Merge
[alias]
vscode = "!code ."
[
{
"caption": "Open Repository in VS Code",
"command": "git",
"args": { "argv": ["vscode"] }
}
]
[
{
"caption": "Open Repository in VS Code",
"command": "git",
"args": { "argv": ["vscode"] }
}
]
[
{
"id": "repository",
"children": [
{ "caption": "-" },
{
"caption": "Open Repository in VS Code",
"command": "git",
"args": { "argv": ["vscode"] }
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment