mode_keymap

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableMode

func EnableMode(keymap interface{}, mode string)

EnableMode enables all key bindings in the given keymap that are tagged with the provided mode.

func ForEachKeyBinding

func ForEachKeyBinding(keymap interface{}, f func(b *key.Binding, modes Modes))

ForEachKeyBinding calls the given function f on every key.Binding in the given keymap, passing the binding and its associated modes. It recurses into nested structs and pointers, extracting all key.Bindings.

Types

type ModeKeyMap

type ModeKeyMap struct {
	Accept key.Binding `keymap-mode:"browse,new"`
	Help   key.Binding `keymap-mode:"*"`
	Exit   key.Binding `keymap-mode:"browse,new"`
	Cancel key.Binding
}

type Modes

type Modes map[string]interface{}

func NewModes

func NewModes(modes []string) Modes

func (Modes) Contains

func (m Modes) Contains(mode string) bool

Contains checks if the given mode exists in the Modes map. If the "*" mode exists, it will match any mode. Otherwise it checks if the specific mode exists.

Jump to

Keyboard shortcuts

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