Skip to main content
Glass provides a flexible keybinding system that allows you to customize keyboard shortcuts for any action. You can use preset keymaps from other editors or create your own custom bindings.

Base Keymap

Glass supports several base keymaps that provide familiar shortcuts from other editors:
settings.json
{
  "base_keymap": "VSCode"
}
base_keymap
string
default:"VSCode"
Available options:
  • "VSCode" - Visual Studio Code keybindings
  • "Atom" - Atom editor keybindings
  • "JetBrains" - JetBrains IDEs keybindings
  • "SublimeText" - Sublime Text keybindings
  • "TextMate" - TextMate keybindings
  • "None" - Minimal default keybindings
The base keymap provides default keybindings. Your custom keybindings in keymap.json will override these defaults.

Keymap File

Custom keybindings are defined in ~/.config/glass/keymap.json (or equivalent on your platform). The keymap file contains an array of binding contexts:
keymap.json
[
  {
    "context": "Workspace",
    "bindings": {
      "ctrl-shift-p": "command_palette::Toggle",
      "ctrl-p": "file_finder::Toggle"
    }
  },
  {
    "context": "Editor",
    "bindings": {
      "ctrl-/": "editor::ToggleComments",
      "ctrl-d": "editor::SelectNext"
    }
  }
]

Binding Structure

Each keybinding consists of:
  1. Context - Where the keybinding is active
  2. Keystroke - The key combination to trigger the action
  3. Action - The command to execute
  4. Arguments (optional) - Parameters passed to the action

Context Predicates

Contexts determine when keybindings are active. Common contexts include:
  • Workspace - Active in any workspace
  • Editor - Active when an editor has focus
  • Terminal - Active in terminal panes
  • Picker - Active in pickers and modals
  • ProjectPanel - Active in the file tree
  • Pane - Active in any pane
Contexts can be combined with predicates:
keymap.json
[
  {
    "context": "Editor && vim_mode == normal",
    "bindings": {
      "space f f": "file_finder::Toggle"
    }
  }
]
Supported operators:
  • && - Logical AND
  • || - Logical OR
  • ! - Logical NOT
  • == - Equality check
  • != - Inequality check

Keystroke Syntax

Keybindings use a string format with modifiers and keys:
ctrl-s
alt-enter
shift-tab

Platform Modifiers

Modifiers adapt to your platform:
  • ctrl - Control on Linux/Windows, Command on macOS
  • alt - Alt on Linux/Windows, Option on macOS
  • shift - Shift on all platforms
  • cmd - Command (macOS only)
Use ctrl for cross-platform keybindings. It automatically maps to Command on macOS and Control on other platforms.

Action Arguments

Many actions accept optional arguments:
keymap.json
[
  {
    "context": "Editor",
    "bindings": {
      "ctrl-enter": ["editor::Newline", { "direction": "above" }],
      "shift-delete": ["editor::Delete", { "ignore_newlines": true }],
      "ctrl-=": ["zed::IncreaseBufferFontSize", { "persist": false }]
    }
  }
]
When arguments are provided, the action is specified as an array with the action name and an object containing the arguments.

Keymap Editor

Glass includes a visual keymap editor for managing keybindings: Open the keymap editor:
  • Command Palette: zed: open keymap
  • Menu: Settings → Keymap

Features

  • Action search - Filter by action name with fuzzy matching
  • Keystroke search - Find bindings by keyboard shortcut
  • Conflict filter - Show only conflicting keybindings
  • Exact matching - Toggle exact keystroke matching
The keymap editor is implemented in crates/keymap_editor/ and provides real-time validation and conflict detection.

Common Actions

Frequently customized actions:
{
  "ctrl-p": "file_finder::Toggle",
  "ctrl-shift-p": "command_palette::Toggle",
  "ctrl-s": "workspace::Save",
  "ctrl-shift-s": "workspace::SaveAs"
}

Discovering Actions

To find action names for keybindings:
  1. Command Palette - Search for commands and view their action names
  2. Keymap Editor - Browse all available actions
  3. Default Keymap - View the base keymap with zed: open default keymap
  4. Documentation - Action names are listed with keyboard shortcuts throughout the docs
Many UI elements show keyboard shortcuts in tooltips. Hover over buttons and menu items to see associated actions.

Keymap File Location

Keymap configuration files are stored in:
  • Linux: ~/.config/glass/keymap.json
  • macOS: ~/Library/Application Support/Glass/keymap.json
  • Windows: %APPDATA%\Glass\keymap.json
The default keymaps are located in assets/keymaps/ in the source tree:
  • default-macos.json
  • default-linux.json
  • default-windows.json

Reloading Keymaps

Keybindings are automatically reloaded when you save your keymap.json file. Changes take effect immediately without restarting Glass. The keymap system is managed by the KeymapFile and SettingsStore in crates/settings/, with live reload triggered through the KeymapEventChannel.

Build docs developers (and LLMs) love