Documentation
¶
Overview ¶
Package kit holds the shared vocabulary for declaring default command modules: key-sequence builders, signature helpers, option and completion constructors. Module packages import it to keep their bindings terse
Index ¶
- Variables
- func Alt(r rune) command.KeyBinding
- func AltKey(b command.KeyBinding) command.KeyBinding
- func BoolOr(p *bool, def bool) bool
- func Char(r rune) command.KeyBinding
- func Continuation(fn command.KeyAction) command.Run
- func Ctrl(r rune) command.KeyBinding
- func EditorBoolOption(key string, get EditorGetter[bool], set EditorSetter[bool]) command.Option
- func EditorNullableIntOption(key string, dflt int, get EditorGetter[*int], set EditorSetter[*int]) command.Option
- func FileCompleter(e *view.Editor, _ *command.Args, input string) []command.Completion
- func FileSig(sig command.Signature) command.Signature
- func IntOr(p *int, def int) int
- func Keys(alts ...command.KeyBinding) map[view.Mode]command.KeyBinding
- func Label(label string, prefix command.KeyBinding, modes view.Mode) command.PrefixLabel
- func Leader(ch rune) map[view.Mode]command.KeyBinding
- func MinArgs(n int) command.Signature
- func OptionalArg() command.Signature
- func Or(alts ...command.KeyBinding) command.KeyBinding
- func Prefixed(prefix command.KeyBinding) func(...command.KeyBinding) command.KeyBinding
- func RegisterHints(e *view.Editor) []command.KeyHint
- func RequiredArg() command.Signature
- func Runner(fn command.Action) command.Run
- func Seq(parts ...command.KeyBinding) command.KeyBinding
- func Shift(b command.KeyBinding) command.KeyBinding
- func Special(s command.Special) command.KeyBinding
- func StaticSig(sig command.Signature, items ...string) command.Signature
- func Window(subs ...command.KeyBinding) map[view.Mode]command.KeyBinding
- type EditorGetter
- type EditorSetter
Constants ¶
This section is empty.
Variables ¶
var ( LeaderBinding = Or(Char(' '), Ctrl('\\')) // LeaderPrefix enters the shared leader menu, reachable by Space or Ctrl-\ LeaderPrefix = Prefixed(LeaderBinding) )
var ( Up = Special(command.Up) Down = Special(command.Down) Left = Special(command.Left) Right = Special(command.Right) Home = Special(command.Home) End = Special(command.End) PgUp = Special(command.PageUp) PgDn = Special(command.PageDown) Tab = Special(command.Tab) Esc = Special(command.Escape) Ret = Special(command.Enter) Del = Special(command.Delete) Bksp = Special(command.Backspace) )
Terse bindings for the plain special keys, named by their keycap form
Functions ¶
func AltKey ¶ added in v0.3.2
func AltKey(b command.KeyBinding) command.KeyBinding
AltKey is the binding for Alt held with the keys of another binding
func Char ¶
func Char(r rune) command.KeyBinding
Char is the single-key binding for a rune, adding Shift for an uppercase
func Continuation ¶
Continuation wraps a KeyAction into a command Run
func EditorBoolOption ¶
EditorBoolOption builds a toggleable option over a bool editor value
func EditorNullableIntOption ¶
func EditorNullableIntOption( key string, dflt int, get EditorGetter[*int], set EditorSetter[*int], ) command.Option
EditorNullableIntOption builds an option over a nullable int editor value, reporting dflt when unset
func FileCompleter ¶
FileCompleter completes a positional argument against filesystem entries under the editor's working directory
func Keys ¶
func Keys(alts ...command.KeyBinding) map[view.Mode]command.KeyBinding
Keys builds the any-mode binding map from the given alternatives
func Label ¶
func Label( label string, prefix command.KeyBinding, modes view.Mode, ) command.PrefixLabel
Label names a prefix key sequence for the pending-key hint popup
func Leader ¶
func Leader(ch rune) map[view.Mode]command.KeyBinding
Leader binds ch under the shared leader (see LeaderPrefix)
func OptionalArg ¶
OptionalArg is a signature accepting zero or one positional argument
func Or ¶
func Or(alts ...command.KeyBinding) command.KeyBinding
Or unions its arguments into a single binding of alternative sequences, so any one of them triggers the command or enters the shared prefix state
func Prefixed ¶
func Prefixed( prefix command.KeyBinding, ) func(...command.KeyBinding) command.KeyBinding
Prefixed returns a builder that joins prefix ahead of any of the sub-bindings
func RegisterHints ¶ added in v0.3.0
RegisterHints offers the registers currently holding a value
func RequiredArg ¶ added in v0.3.0
RequiredArg is a signature accepting exactly one positional argument
func Seq ¶
func Seq(parts ...command.KeyBinding) command.KeyBinding
Seq concatenates parts into sequences, expanding an Or at any position into the cross-product of the alternatives around it
func Shift ¶
func Shift(b command.KeyBinding) command.KeyBinding
Shift is the binding for Shift held with the keys of another binding
func Special ¶
func Special(s command.Special) command.KeyBinding
Special is the binding for a special key
func Window ¶
func Window( subs ...command.KeyBinding, ) map[view.Mode]command.KeyBinding
Window binds each sub under the Ctrl-w window chord or the leader's w menu, so window management shares the leader wherever the leader is reachable
Types ¶
type EditorGetter ¶
EditorGetter reads a typed value from the editor
type EditorSetter ¶
EditorSetter writes a typed value to the editor