Skip to main content

API Structure

The Glide Browser API is exposed through the global glide object, which provides programmatic access to browser functionality through TypeScript. The API is organized into logical namespaces for different browser features.

Core Namespaces

glide.keymaps

Define and manage keyboard mappings across different modes

glide.excmds

Execute and create custom ex-commands

glide.autocmds

Create event-driven automation with autocmds

glide.tabs

Query and manage browser tabs

glide.hints

Show and customize hint-based navigation

glide.commandline

Control the command-line interface

glide.findbar

Interact with the native find-in-page UI

glide.styles

Add and manage custom CSS for the browser UI

System Integration

glide.process

Spawn and manage system processes

glide.fs

Read and write files to the filesystem

glide.path

Work with file system paths

glide.env

Get and set environment variables

glide.prefs

Manage Firefox preferences

Content & Communication

glide.content

Execute code in the content process

glide.messengers

Create type-safe IPC messengers

glide.keys

Send and capture keyboard events

Extensions & Customization

glide.addons

Install and manage browser extensions

glide.search_engines

Add and configure search engines

glide.modes

Register custom modes

Configuration

Options (glide.o)

The glide.o object contains browser-wide configuration options:
glide.o.mapping_timeout = 200;
glide.o.hint_size = "12px";
glide.o.native_tabs = "autohide";
glide.o.newtab_url = "about:blank";

Buffer Options (glide.bo)

Buffer-specific options that reset when navigating to a new page:
glide.bo.hint_size = "14px"; // Only for current buffer

Globals (glide.g)

Store arbitrary data and configure global settings:
glide.g.mapleader = "<Space>";

// Store custom data
declare global {
  interface GlideGlobals {
    my_custom_data?: boolean;
  }
}
glide.g.my_custom_data = true;

Context (glide.ctx)

Access runtime information about the current state:
const mode = glide.ctx.mode;              // "normal" | "insert" | "visual" | ...
const url = glide.ctx.url;                // Current tab URL
const os = glide.ctx.os;                  // "linux" | "win" | "macosx" | ...
const version = glide.ctx.version;        // Glide version
const isEditing = await glide.ctx.is_editing(); // Is cursor in editable field?

Buffer-Scoped APIs

The glide.buf namespace provides buffer-scoped versions of certain APIs:
  • glide.buf.keymaps - Set keymaps that only apply to the current buffer
  • glide.buf.prefs - Set preferences that reset when leaving the buffer
// These settings only apply to the current page
glide.buf.keymaps.set("normal", "j", "scroll_down");
glide.buf.prefs.set("layout.css.devPixelsPerPx", "1.5");

Utility Functions

glide.include()

Include another TypeScript config file:
await glide.include("shared-config.ts");

glide.options.get()

Get an option value, checking buffer-specific options first:
const hintSize = glide.options.get("hint_size");

Type Safety

The Glide API is fully typed with TypeScript. You can extend types using declaration merging:
declare global {
  interface GlideOptions {
    my_custom_option?: string;
  }
  
  interface GlideGlobals {
    my_data?: number[];
  }
  
  interface ExcmdRegistry {
    my_command: { name: "my_command" };
  }
}

Next Steps

Getting Started

Write your first Glide configuration

Examples

Browse example configurations and patterns