Skip to content

VS Code

Set editor = "vscode" to open VS Code over the active pane with <prefix> + e. VS Code opens at the pane’s worktree root or, outside Git, its directory. On touch screens, use the key bar to hide it.

Requires macOS or Linux, and either VS Code or openvscode-server on the server (see Server). Webviews such as the Markdown preview need internet access.

Press the prefix twice to send it to VS Code. With the default prefix, Ctrl+A Ctrl+A sends one Ctrl+A.

VS Code reloads only when shown over a pane in another folder, which ends its terminals and tasks. Over a pane connected to another host (ssh), it keeps its folder.

Over a pane of a sandboxed session, VS Code still runs on the host: its terminals, tasks, and extensions act on files the sandbox can change, with your account. btmux warns about this once per session.

Files open in every client showing that folder. You can also open VS Code directly with another default editor.

[vscode]
server = "code"

btmux reads server at VS Code startup.

  • "code" (default) runs code serve-web from an installed VS Code, found on the server’s PATH, your shell’s, or in /Applications on macOS. It downloads the matching server on first use, and btmux asks you once per profile to accept the VS Code Server license.
  • "openvscode-server" uses openvscode-server from PATH.

When btmux’s PATH lacks the server, as a service’s may, VS Code runs with your shell’s, so extensions find the same tools as your panes.

User data and extensions are kept per profile, in a vscode directory beside the profile’s state file.

[vscode]
desktop = true
# profile = "Work"
# settings = "~/.config/Code/User/settings.json"
# keybindings = "~/.config/Code/User/keybindings.json"
# extensions = ["~/.vscode/extensions"]

desktop = true shares desktop VS Code’s settings, key bindings, and extensions with btmux’s VS Code. It reads them from the default locations:

What macOS Linux
Settings and key bindings ~/Library/Application Support/Code/User $XDG_CONFIG_HOME/Code/User
Extensions ~/.vscode/extensions ~/.vscode/extensions
  • settings, keybindings, and extensions override those paths, and work without desktop: for VSCodium or Insiders, say. extensions lists extension folders, or folders of them.
  • profile shares a desktop profile by name instead of the default one, with whatever it takes from the default profile. A profile with no extensions of its own yet shares none.
  • With Home Manager, programs.vscode writes the default locations, so programs.btmux.settings.vscode.desktop = true is all it takes.

btmux stores browser settings separately and applies changes from shared files each time a VS Code window loads.

  • A change you make in btmux’s VS Code stays until the shared file changes the same setting or binding.
  • Key bindings follow the shared file’s order, which decides which of two bindings for a key wins. Bindings added in btmux’s VS Code keep their place among them.

btmux links shared extensions at startup and refreshes the links when desktop VS Code installs, updates, or removes an extension.

  • Desktop VS Code updates them; btmux’s doesn’t.
  • Uninstalling one in btmux’s VS Code lasts until it starts again.
  • Extensions you install in btmux’s VS Code stay, unless desktop VS Code has the same one.
  • With openvscode-server, Microsoft’s and GitHub’s closed-source extensions (Pylance, C/C++, C# Dev Kit, Copilot) aren’t shared, as they run only in Microsoft’s VS Code.

VS Code in the browser runs extensions on the server, in Node.js, or in the browser, so some desktop extensions can’t run:

  • Extensions that run only in the desktop window (extensionKind: ["ui"]) without a web version.
  • Native modules built for desktop VS Code’s Electron, and extensions that use Electron itself; see remote extensions.
  • Extensions that serve a page on localhost (previews, sign-in) and open it in the browser: VS Code’s port forwarding doesn’t work here, so from another device localhost is that device. On the server’s own machine they work.
  • Keys typed in a webview (the Markdown preview, extension panels) reach it before btmux, so after the prefix, the next key reaches it too.

Signing in to a GitHub or Microsoft account works: their sites return you to btmux when you are done.

A bundled extension applies btmux’s color scheme and terminal font to VS Code, overriding shared settings. The editor uses the font at 80% of its size.

To keep your own, turn off btmux.syncTheme or btmux.syncFont in VS Code’s settings. Turned off in shared settings, they give VS Code the shared color scheme or font back.