shortcuts

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 6 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 shortcuts is the keyboard shortcuts view: a scrollable box over the grid listing every key by what it does, in two columns when the screen is wide enough. The rows come from the host, which builds them from the key bindings and the command registry. It knows the UI only through Host.

Index

Constants

View Source
const ID = "shortcuts"

ID identifies the view's box in mouse events.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host interface {
	Theme() *theme.Theme
	Size() (width, height int)
	// Close closes the open overlay.
	Close()
	// Shortcuts are the rows to list, in order.
	Shortcuts() []Row
}

Host is what the shortcuts view needs of the UI.

type Row

type Row struct {
	Heading string
	Keys    []string // as shown, e.g. "Ctrl+G"
	Action  string
}

Row is a line of the view: a group heading, or keys and what they do.

type View

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

View is the open shortcuts view.

func New

func New(h Host) *View

New returns the view scrolled to the top.

func (*View) Indicator

func (s *View) Indicator() string

func (*View) Key

func (s *View) Key(k tea.KeyPressMsg) tea.Cmd

func (*View) Layout

func (s *View) Layout() []overlay.Box

func (*View) Lines

func (s *View) Lines() ([]string, int)

Lines renders the rows, as one or two columns, and returns their width.

func (*View) Mouse

func (s *View) Mouse(e overlay.MouseEvent) tea.Cmd

func (*View) Status

func (s *View) Status() (string, string)

func (*View) Top

func (s *View) Top() int

Top is the first line shown.

Jump to

Keyboard shortcuts

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