Help us shape the future of Go! Take the 2026 Go Developer Survey

keys

package
v0.17.15 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package keys provides shared keybindings for TUI views.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLog = LogKeyMap{
	NavigationKeyMap: DefaultNavigation,
	Search: key.NewBinding(
		key.WithKeys("/"),
		key.WithHelp("/", "search"),
	),
	Expand: key.NewBinding(
		key.WithKeys("space", " ", "enter"),
		key.WithHelp("space", "expand/collapse"),
	),
	Quit: key.NewBinding(
		key.WithKeys("q", "ctrl+c"),
		key.WithHelp("q", "quit"),
	),
}

DefaultLog returns keybindings for log views.

View Source
var DefaultNavigation = NavigationKeyMap{
	Up: key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "up"),
	),
	Down: key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("↓/j", "down"),
	),
	Select: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "select"),
	),
	Cancel: key.NewBinding(
		key.WithKeys("ctrl+c", "esc", "q"),
		key.WithHelp("esc", "cancel"),
	),
}

DefaultNavigation returns standard navigation keybindings with vim support.

View Source
var DefaultReorder = ReorderKeyMap{
	NavigationKeyMap: DefaultNavigation,
	MoveUp: key.NewBinding(
		key.WithKeys("shift+up", "K"),
		key.WithHelp("K", "move up"),
	),
	MoveDown: key.NewBinding(
		key.WithKeys("shift+down", "J"),
		key.WithHelp("J", "move down"),
	),
}

DefaultReorder returns keybindings for reorder views.

View Source
var DefaultSelect = SelectKeyMap{
	NavigationKeyMap: DefaultNavigation,
	Search: key.NewBinding(
		key.WithKeys("/"),
		key.WithHelp("/", "search"),
	),
	Expand: key.NewBinding(
		key.WithKeys("space", " "),
		key.WithHelp("space", "expand/collapse"),
	),
}

DefaultSelect returns keybindings for selection views.

Functions

This section is empty.

Types

type LogKeyMap

type LogKeyMap struct {
	NavigationKeyMap
	Search key.Binding
	Expand key.Binding
	Quit   key.Binding
}

LogKeyMap extends NavigationKeyMap with log-specific operations.

type NavigationKeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Select key.Binding
	Cancel key.Binding
}

NavigationKeyMap provides standard navigation keybindings shared across TUI views.

type ReorderKeyMap

type ReorderKeyMap struct {
	NavigationKeyMap
	MoveUp   key.Binding
	MoveDown key.Binding
}

ReorderKeyMap extends NavigationKeyMap with move operations for reordering.

type SelectKeyMap

type SelectKeyMap struct {
	NavigationKeyMap
	Search key.Binding
	Expand key.Binding
}

SelectKeyMap provides keybindings for selection mode.

Jump to

Keyboard shortcuts

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