keymap

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package keymap provides global key bindings and helpers for building keymaps.

Index

Constants

This section is empty.

Variables

View Source
var (
	Quit = key.NewBinding(
		key.WithKeys("ctrl+c"),
		key.WithHelp("ctrl+c", "quit"),
	)
	Exit = key.NewBinding(
		key.WithKeys("esc"),
		key.WithHelp("", ""),
	)

	// Global is shown in the keybar across all screens.
	Global = []key.Binding{Quit}
)

Global bindings — always active.

View Source
var (
	Tab = key.NewBinding(
		key.WithKeys("tab"),
		key.WithHelp("tab", "switch focus"),
	)
	Send = key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "send"),
	)
	Newline = key.NewBinding(
		key.WithKeys("shift+enter", "alt+enter", "ctrl+j"),
		key.WithHelp("shift+enter", "newline"),
	)
	Details = key.NewBinding(
		key.WithKeys("ctrl+d"),
		key.WithHelp("ctrl+d", "details"),
	)
	Palette = key.NewBinding(
		key.WithKeys("/"),
		key.WithHelp("/", "commands"),
	)
)

App bindings — active during normal interaction.

View Source
var (
	NextTab = key.NewBinding(
		key.WithKeys("tab"),
		key.WithHelp("tab", "next tab"),
	)
	CloseDrawer = key.NewBinding(
		key.WithKeys("esc"),
		key.WithHelp("esc", "close"),
	)
	DrawerUp = key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "up"),
	)
	DrawerDown = key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("↓/j", "down"),
	)
	DrawerSelect = key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "select"),
	)
	DrawerBack = key.NewBinding(
		key.WithKeys("esc", "backspace"),
		key.WithHelp("esc/bksp", "back"),
	)
)

Drawer bindings — active when the statusbar drawer is open.

Functions

This section is empty.

Types

type Simple

type Simple struct {
	Keys []key.Binding
}

Simple implements help.KeyMap with a basic list of key bindings. Use this when you need to return dynamic keymaps from Help() methods.

func (Simple) FullHelp

func (k Simple) FullHelp() [][]key.Binding

FullHelp returns the key bindings for the full help view.

func (Simple) ShortHelp

func (k Simple) ShortHelp() []key.Binding

ShortHelp returns the key bindings for the short help view.

Jump to

Keyboard shortcuts

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