prefix

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package prefix caches the tmux prefix key and its binding table.

Frontend can't invoke "C-b" directly via send-keys (it would just be sent as a key press to the active program), so the server runs an FSM:

  1. user sends prefix key → enter "prefix waiting" state
  2. next key → look up binding in this cache → run the bound command

Mirrors stations/tmux-webui/server.py:383-463.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache lazily fetches the prefix key + bindings on first access. Safe for concurrent use; subsequent calls return the cached value.

func New

func New(c *tmuxctl.Client) *Cache

func (*Cache) Bindings

func (c *Cache) Bindings(ctx context.Context) map[string]string

Bindings returns key→tmux-command from `tmux list-keys -T prefix`. Empty map on error (callers should fall back to sending the raw key).

func (*Cache) Key

func (c *Cache) Key(ctx context.Context) string

Key returns the global tmux prefix key (e.g., "C-b"). Falls back to "C-b" on any tmux error to keep the FSM functional even if the local tmux binary is missing or misbehaving.

func (*Cache) Lookup

func (c *Cache) Lookup(ctx context.Context, keyCombo string) string

Lookup returns the bound tmux command for keyCombo. Empty string means no binding — caller should send the key as a raw input.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL